Now you can create a data frame. Sometimes data frames can have hundreds of rows or columns. What if you want to work with a specific set of rows or columns? You have to extract those rows and columns from the data frame. To do that, you use one vector containing the position of the specific rows and another with the position of specific columns. For example:
Notice that the data frame name comes first, then the vector commands are in brackets. The desired row and column positions are in parenthesis.
This command will select rows 1 and 2 (the first vector is for rows) and columns 2 and 4 (the second vector is for columns). This will return:
1 M TRUE
2 M FALSE
If you want to return all columns for specific rows, you simply omit the second vector (but remember the final comma!):
Similarly, when you want specific columns for all rows, you omit the first vector (but keep the first comma!):