rn_cols | R Documentation |
using data.table packages setnames function to change column names
rn_cols(dt, old=NULL, new=NULL, ...)
dt |
input data.table |
old |
default = NULL vector of existing column names |
new |
default = NULL vector of new column names |
... |
non-standard evaluation of in the form of an expression such as, old_column_name = new_column_name |
User can use provide a vector of characters for current column names and a vector of characters of equal lengths as new column names. Alternatively, user can also use the old_column_name=new_column_name notation, separated by comma.
## Not run: rn_cols(dt, hp=horsepower, disp=displacement) rn_cols(dt, old=c("hp", "disp", "cyl"), new=c("horsepower", "displacement", "cylinder")) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.