i

R Programming Complete Tutorial

Data Extraction

In this section, data extraction of the data frame will be explained. We already know how to access any data element using by index.

For the index [3, 4], first, it will go to the third row and then the fourth column, and it will retrieve 2019-07-20. If we want to extract a column of a data frame, we have to use a dollar symbol to retrieve that column. In our example, it will display all the data of the Balance column.

We can create a new data frame using the existing column of any data frame. Here we created a data frame using only the Cust_id and Balance column of the bank.data, data frame.

Sometimes, we need to work with the subset of a data frame. We can even use conditions in the subset function.

We can extract any row, only mentioning the row number at the first position of the index and keeping the second position as black. We can even select a specific range of data.