| nest_rename | R Documentation |
nest_rename() changes the names of individual variables using
new_name = old_name syntax; nest_rename_with() renames columns using a
function.
nest_rename(.data, .nest_data, ...)
nest_rename_with(.data, .nest_data, .fn, .cols = dplyr::everything(), ...)
.data |
A data frame, data frame extension (e.g., a tibble), or a lazy data frame (e.g., from dbplyr or dtplyr). |
.nest_data |
A list-column containing data frames |
... |
For For |
.fn |
A function used to transform the selected |
.cols |
Columns to rename; defaults to all columns. |
nest_rename() and nest_rename_with() are largely wrappers for
dplyr::rename() and dplyr::rename_with() and maintain the functionality
of rename() and rename_with() within each nested data frame. For more
information on rename() or rename_with(), please refer to the
documentation in dplyr.
An object of the same type as .data. Each object in the column .nest_data
will also be of the same type as the input. Each object in .nest_data has
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.
Other single table verbs:
nest_arrange(),
nest_filter(),
nest_mutate(),
nest_select(),
nest_slice(),
nest_summarise()
gm_nest <- gapminder::gapminder %>% tidyr::nest(country_data = -continent)
gm_nest %>% nest_rename(country_data, population = pop)
gm_nest %>% nest_rename_with(country_data, stringr::str_to_lower)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.