unite_rows | R Documentation |
This function performs the converse to separate_rows() / separate_longer_delim() functions. Adapted from https://stackoverflow.com/a/56810542. Note this function allows non-standard evaluation. Quotes for column names and groups are optional.
unite_rows(.data, input_colname, output_colname, group_var, delim = ";")
.data |
A tibble. |
input_colname |
The column name to collapse into rows. |
output_colname |
The new column name to contain collapsed data. |
group_var |
Any number of grouping columns. |
delim |
Delimiter for collapsed data. |
see tidyExt vignette
If no groups are specified, returns a vector; else returns an ungrouped dataframe.
require(ggplot2)
mpg |> unite_rows(displ, displ_str, class)
mpg |> unite_rows(displ, displ_str, c(class, cyl), delim=',')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.