Change Name of Vector or Data Frame Object in R (Example Code)

This post illustrates how to rename data objects in R.

Creating Example Data

my_x <- 1:5                          # Create vector object
my_x                                 # Show vector in RStudio console
# [1] 1 2 3 4 5

Example: Store Values of Vector in New Data Object

my_x_new <- my_x                     # Rename data object in R
my_x_new                             # Show new vector object in RStudio console
# [1] 1 2 3 4 5

Further Resources

Have a look at the following tutorials. They explain topics such as lines, graphics in R, data objects, and character strings:

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed