| rename {poorman} | R Documentation |
Rename columns
Description
rename() changes the names of individual variables using new_name = old_name syntax.
rename_with() renames columns using a function.
Usage
rename(.data, ...)
rename_with(.data, .fn, .cols = everything(), ...)
Arguments
.data |
A |
... |
For For |
.fn |
A |
.cols |
Columns to rename; defaults to all columns. |
Value
A data.frame with the following properties:
Rows are not affected.
Column names are changed; column order is preserved.
-
data.frameattributes are preserved. Groups are updated to reflect new names.
Examples
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"))
[Package poorman version 0.2.7 Index]