View source: R/spread-groups.R
spread_groups | R Documentation |
Function that is used during interpretation of group pack output. It converts grouped summary into column pack format.
spread_groups(.tbl, ..., .group_sep = ".", .col_sep = "._.")
.tbl |
Data frame with result of grouped summary. |
... |
A selection of grouping columns (as in |
.group_sep |
A string to be used as separator of grouping levels. |
.col_sep |
A string to be used as separator in column pack. |
Multiple grouping variables are converted to one with
tidyr::unite()
and separator .group_sep
. New values are then treated as
variable names which should be validated and which represent the group data
as a whole.
A data frame in column pack format.
mtcars_grouped_summary <- mtcars %>%
dplyr::group_by(vs, am) %>%
dplyr::summarise(n_low = dplyr::n() > 6, n_high = dplyr::n() < 10)
spread_groups(mtcars_grouped_summary, vs, am)
spread_groups(mtcars_grouped_summary, vs, am, .group_sep = "__")
spread_groups(mtcars_grouped_summary, vs, am, .col_sep = "__")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.