recol | R Documentation |
recol()
is a small function which can rename columns and change factors to relevant input
recol(df, old, new, factors=NULL, remove=TRUE, na=NA)
df |
dataframe. ( |
old |
old column name. ( |
new |
new column name. ( |
factors |
Named list of factors. If no names then just in alphabetical order ( |
remove |
remove old column from dataframe ( |
na |
the na.strings ( |
Returns the dataframe with new columns.
## Not run:
# NUMERIC VARIABLE
df <- recol(df, "X5d_55_Alcohol_127", "Alcohol")
# FACTOR VARIABLE
df <- recol(df, "X5d_55_Alcohol_127", "Alcohol", factors=c("No","Yes"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.