Description Usage Arguments See Also Examples
This function discards specified dimensions summary by filtering only for the attribute value "All". If no dimensions are specified, it discards all of them. If the table is grouped, this ungroups it.
1 | discard_dimensions(tbl, ..., quietly = FALSE)
|
tbl |
A metric tbl in wide format, with one or more dimensions. |
... |
Dimensions to discard. |
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 18 19 20 21 22 23 | library(dplyr)
mtcars_by_cyl_gear <- mtcars %>%
cross_by_dimensions(cyl, gear) %>%
summarize(avg_mpg = mean(mpg))
# Discard all dimensions
mtcars_by_cyl_gear %>%
discard_dimensions()
# Remove dimension cyl
mtcars_by_cyl_gear %>%
discard_dimensions(cyl)
# Remove all dimensions except `cyl`
mtcars_by_cyl_gear %>%
discard_dimensions(-cyl)
mtcars_by_cyl_gear %>%
discard_dimensions(-cyl, -gear)
mtcars_by_cyl_gear %>%
discard_dimensions(-one_of("cyl", "gear"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.