Description Usage Arguments Value Examples
Rename columns in a table
1 | rename_cols(.tbl, .vars, strict = TRUE)
|
.tbl |
Table to rename |
.vars |
A named character vector, where the names are the new column names and the values are existing column names. |
strict |
Should the function raise an error if existing column names can't be found? (Default TRUE) |
The same .tbl, with some renamed columns
Note that this function is the same as colnames()<-
for in-memory
data.frames, but also works for remote tbls. It's similar to pandas'
.rename
method.
1 2 | cols_to_rename <- c(cyl2 = "cyl")
rename_cols(mtcars, cols_to_rename)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.