Description Usage Arguments Value Examples
rename()
changes the names of individual variables using new_name = old_name
syntax.
rename_with()
renames columns using a function.
1 2 3 | rename(.data, ...)
rename_with(.data, .fn, .cols = everything(), ...)
|
.data |
A |
... |
For For |
.fn |
A |
.cols |
Columns to rename; defaults to all columns. |
A data.frame
with the following properties:
Rows are not affected.
Column names are changed; column order is preserved.
data.frame
attributes are preserved.
Groups are updated to reflect new names.
1 2 3 4 5 6 | rename(mtcars, MilesPerGallon = mpg)
rename(mtcars, Cylinders = cyl, Gears = gear)
mtcars %>% rename(MilesPerGallon = mpg)
rename_with(mtcars, toupper)
rename_with(mtcars, toupper, starts_with("c"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.