Description Usage Arguments See Also Examples
This function keeps specified dimensions from a wide metric tbl and discards the rest.
1 | keep_dimensions(tbl, ..., keep_attribute_all = FALSE, quietly = FALSE)
|
tbl |
A metric tbl in wide format, with one or more dimensions. |
... |
Dimensions to keep, as bare names
or select helpers like |
keep_attribute_all |
Whether to remove the "All" level from the dimensions |
quietly |
If FALSE (default), display a message about what columns are being discarded. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | library(dplyr)
mtcars_by_cyl_gear <- mtcars %>%
cross_by_dimensions(cyl, gear) %>%
summarize(avg_mpg = mean(mpg))
mtcars_by_cyl_gear %>%
keep_dimensions()
mtcars_by_cyl_gear %>%
keep_dimensions(cyl)
mtcars_by_cyl_gear %>%
keep_dimensions(-cyl)
mtcars_by_cyl_gear %>%
keep_dimensions(cyl, keep_attribute_all = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.