nest_unite | R Documentation |
nest_unite()
is used to combine multiple columns into one in a column of
nested data frames.
nest_unite( .data, .nest_data, col, ..., sep = "_", remove = TRUE, na.rm = FALSE )
.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 |
col |
The name of the new column, as a string or symbol. This argument is passed by expression and supports
quasiquotation (you can unquote strings
and symbols). The name is captured from the expression with
|
... |
Columns to unite. |
sep |
Separator to use between values. |
remove |
If |
na.rm |
If |
nest_unite()
is a wrapper for tidyr::unite()
and maintains the functionality
of unite()
within each nested data frame. For more information on unite()
please refer to the documentation in 'tidyr'.
An object of the same type as .data
. Each object in the column .nest_data
will have a new column created as a combination of existing columns.
Other tidyr verbs:
nest_drop_na()
,
nest_extract()
,
nest_fill()
,
nest_replace_na()
,
nest_separate()
set.seed(123) gm <- gapminder::gapminder gm_nest <- gm %>% tidyr::nest(country_data = -continent) gm_nest %>% nest_unite(.nest_data = country_data, col = comb, year, pop)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.