dtAggregate | R Documentation |
Collapse data-tables
dtAggregate(
DT,
aggr_on,
measure.vars = c(),
id.vars = c(),
func = "sum",
na.rm = TRUE
)
DT |
Data-table (required) |
aggr_on |
Character string (required): column-name that will be used to collapse on (i.e. combine all age-strata) |
measure.vars |
Character string (optional): column-names that will be collapsed (function will be applied to all these columns) |
id.vars |
Character string (optional): column-names that will remain stratified N.b. if measure.vars is not provided, all columns that are not in id.vars and aggr_on will be assumed to be assumed |
func |
Character string (optional): function that will be applied to data (if optional, values will be summed) |
na.rm |
Logical (optional): if TRUE, removes NA from measure.vars columns before applying function (or passes na.rm=TRUE to function) |
Returns collapsed data.table
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.