transform() function in R Language is used to modify data. It converts the first argument to the data frame.
This function is used to transform/modify the data frame in a quick and easy way.
data: Data Frame to be modified
value: new modified value of data
Example 1: Use transform() on variables
x1= 11, 12, 13, 14. x2 = 5, 6, 7, 8.
Here in the above code, we have a data framework and we transform it by adding 10(x1 = x1 + 10) to each of the values.
The values of x2 will not get changed as we do not apply any transformation to it.
Example 2: Add new variables to data
X1= 11, 12, 13, 14. X2 = 5, 6, 7, 8. X3 = 1, 3, 3, 4.
Here in the above code, we are adding a new variable x3 to the previous data.
- Modify Data of a Data Frame with an Expression in R Programming - with() Function
- Condense Column Values of a Data Frame in R Programming - summarise() Function
- 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
- Get Transpose of a Matrix or Data Frame in R Programming - t() Function
- Convert a Data Frame into a Numeric Matrix in R Programming - data.matrix() Function
- Create Subsets of a Data frame in R Programming - subset() Function
- Take Random Samples from a Data Frame in R Programming - sample_n() Function
- Choose Specific Columns of a Data Frame in R Programming - select() Function
- Accessing variables of a data frame in R Programming - attach() and detach() function
- Binding rows and columns of a Data Frame in R - bind_rows() and bind_cols() Function
- Convert a Data Frame into a Molten Form in R Programming - melt() Function
- Rounding off values in R Language - round() Function
- Create a Data Frame of all the Combinations of Vectors passed as Argument in R Programming - expand.grid() Function
- Changing row and column values of a Matrix in R Language - sweep() function
- Add new Variables to a Data Frame using Existing Variables in R Programming - mutate() Function
- Rename Columns of a Data Frame in R Programming - rename() Function
- Combine Vectors, Matrix or Data Frames by Columns in R Language - cbind() Function
- Combine Vectors, Matrix or Data Frames by Rows in R Language - rbind() Function
- Comparing values of data frames in R Programming - all_equal() 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 email@example.com. 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.