I'm new to R and am trying to work with a relatively large data frame. I am trying to reduce a large data frame to just the variables I need. I kind of figured out how to do that with data.frame
function. However, is there a way to change the variable names in the same step?
Example below:
Say my existing dataset has 10 variables (columns): Var1, var2, var3... I only want to leave first 2 variables. So i write:
small_data <- data.frame(var1, var2)
So the question is can i somehow change the names of the variables within that data.frame
function?