agg_data {ezplot} | R Documentation |
Aggregates data
Description
Aggregates data
Usage
agg_data(
data,
cols = names(data),
group_by = NULL,
agg_fun = function(x) sum(x, na.rm = TRUE),
group_by2 = NULL,
env = parent.frame()
)
Arguments
data |
A data.frame. |
cols |
Named character vector of column names. |
group_by |
Vector of grouping columns. |
agg_fun |
Function to use for aggregating. |
group_by2 |
Vector of grouping column names to use for delayed (post aggregation) calculation. |
env |
Environment for extra variables. |
Value
An aggregated data.frame.
Examples
suppressPackageStartupMessages(library(tsibble))
library(tsibbledata)
agg_data(ansett, c("Passengers", count = "1"))
agg_data(ansett["Class"])
agg_data(ansett[c("Class", "Passengers")])
agg_data(ansett, "Passengers", "Class")
agg_data(ansett, "Passengers", c("Class", "Airports"))
agg_data(ansett, c(x = "Airports", y = "Passengers"), c(x = "Airports"))
agg_data(ansett, c(x = "Class", y = "1", group = "Airports"), c(x = "Class", group = "Airports"))
[Package ezplot version 0.7.13 Index]