agg | R Documentation |
This function is great for getting rollups across various dimensions
agg(.data, .dims = NULL, .all_dims, ..., .append = TRUE)
.data |
A data frame |
.dims |
Character vector of column names that represent the data frames dimensions to be grouped by and summarised with the formulas in |
.all_dims |
Character vector of column names that represent the data
frames entire set of dimensions. All other columns will be ignored unless
referenced in |
... |
Named expressions passed to |
.append |
Logical, whether or not to append the aggregated data to
|
Data frame
library(dplyr) agger <- purrr::partial( agg, conc = mean(conc, na.rm = TRUE), uptake = mean(uptake, na.rm = TRUE), .all_dims = c("Plant", "Type", "Treatment") ) tibble::tibble(datasets::CO2) %>% agger(c("Plant", "Type")) %>% agger("Treatment")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.