subset() function in R Language is used to create subsets of a Data frame. This can also be used to drop columns from a data frame.
Syntax: subset(df, expr)
df: Data frame used
expr: Condition for subset
 "Original Data Frame" row1 row2 row3 1 0 3 6 2 1 4 7 3 2 5 8  "Modified Data Frame" row2 1 3 2 4 3 5
Here, in the above code, the original data frame remains intact while another subset of data frame is created which holds selected row from the original data frame.
 "Original Data Frame" row1 row2 row3 1 0 3 6 2 1 4 7 3 2 5 8  "Modified Data Frame" row1 1 0 2 1 3 2
Here, in the above code, the rows are permanently deleted from the original data frame.
- Convert an Object to Data Frame in R Programming - as.data.frame() Function
- Check if the Object is a Data Frame in R Programming - is.data.frame() Function
- Create a Data Frame of all the Combinations of Vectors passed as Argument in R Programming - expand.grid() Function
- Create Matrix and Data Frame from Lists in R Programming
- Convert a Data Frame into a Numeric Matrix in R Programming - data.matrix() Function
- Modify Data of a Data Frame with an Expression in R Programming - with() Function
- Accessing variables of a data frame in R Programming - attach() and detach() function
- Get Transpose of a Matrix or Data Frame in R Programming - t() Function
- Convert a Data Frame into a Molten Form in R Programming - melt() Function
- Rename Columns of a Data Frame in R Programming - rename() Function
- Choose Specific Columns of a Data Frame in R Programming - select() Function
- Add new Variables to a Data Frame using Existing Variables in R Programming - mutate() Function
- Condense Column Values of a Data Frame in R Programming - summarise() Function
- Take Random Samples from a Data Frame in R Programming - sample_n() Function
- Creating a Data Frame from Vectors in R Programming
- Modify values of a Data Frame in R Language - transform() Function
- Binding rows and columns of a Data Frame in R - bind_rows() and bind_cols() Function
- Create Quantiles of a Data Set in R Programming - quantile() Function
- Create a Tabular representation of Data in R Programming - table() Function
- Compute Summary Statistics of Subsets in R Programming - aggregate() function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.