recol {clintools} | R Documentation |
Reorder column (recol)
Description
recol()
is a small function which can rename columns and change factors to relevant input
Usage
recol(df, old, new, factors=NULL, remove=TRUE, na=NA)
Arguments
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 ( |
Value
Returns the dataframe with new columns.
Examples
## 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)
[Package clintools version 0.9.10.1 Index]