Answers for "Rename a variable in R"

R
0

rename columns based on a variable in r

df <- rename(df, new_name = old_name) #For renaming dataframe column
 
tbl <- rename(tbl, new_name = old_name) #For renaming tibble column
 
tbl <- tbl %>% rename(new_name = old_name) #For renaming tibble column using dplyrpipe 
                                           #operator
Posted by: Guest on June-21-2020
0

Rename a variable in R

df %>% rename(!!variable := name_of_col_from_df)
Posted by: Guest on June-21-2020

Code answers related to "Rename a variable in R"

Browse Popular Code Answers by Language