aggregate_all: Aggregate a data.frame and create 'ALL' values

Description Usage Arguments Details

View source: R/aggregate_all.r

Description

This function aggregates the specified columns of a data.frame by the specified grouping variables, It also prepares additional aggregations in which each grouping var is set to 'ALL'

Usage

1
aggregate_all(df, group_vars, agg_vars, fun = sum, no_all = NULL)

Arguments

df

A data.table or data.frame

group_vars

A character string of variable names to group by

agg_vars

A character string of variable names to aggregate

fun

The function with which to perform aggregation, default is sum (currently applies the function to all agg_vars)

no_all

A character string indicating which variables are not required to have an 'ALL' row in the final aggregated product, defaults to NULL

Details

If no_all == group_vars then this function merely performs a standard data.table aggregation, but if no_all != group_vars then this function returns all unique combinations of aggregations. Drops columns that do not appear in group_vars or no_all.


joshua-ruf/fidelis documentation built on July 20, 2019, 1:56 a.m.