The Aggregate function (not to be confounded with aggregate) prepares a data.frame, tibble or data.table for merging by computing the sum, mean and variance of all continuous (integer and numeric) variables by a given variable.
For all categorical variabes (character and factor), it creates dummies and subsequently computes the sum and the mode by a given variable.
For all Date variables, it computes the recency and duration by a given variable with repsect the an end date variable.
For computational speed, all the calculations are done with data.table. This functions aims at maximum information extraction with a minimum amount of code.
The package also contains faster implementations of the dummy and categories function (comparable to the same functions in the dummy package). When using the AggregateR package, the dummy-package is deprecated and the internal dummy and categories functions are superior in terms of speed.
This code blocks shows how the Aggregate function works when confronted with a table with numeric, categorical and Date variables. Aggregate accepts a data.frame, tibble or data.table and outputs by default a data.table.
AggregateR
The
Aggregatefunction (not to be confounded withaggregate) prepares adata.frame,tibbleordata.tablefor merging by computing the sum, mean and variance of all continuous (integer and numeric) variables by a given variable. For all categorical variabes (character and factor), it creates dummies and subsequently computes the sum and the mode by a given variable. For all Date variables, it computes the recency and duration by a given variable with repsect the an end date variable. For computational speed, all the calculations are done withdata.table. This functions aims at maximum information extraction with a minimum amount of code.The package also contains faster implementations of the
dummyandcategoriesfunction (comparable to the same functions in thedummypackage). When using theAggregateRpackage, thedummy-package is deprecated and the internaldummyandcategoriesfunctions are superior in terms of speed.Installation
To install the package from CRAN:
To instal the package from github:
Usage
This code blocks shows how the
Aggregatefunction works when confronted with a table with numeric, categorical and Date variables.Aggregateaccepts adata.frame,tibbleordata.tableand outputs by default adata.table.As mentioned, the user can also output a tibble for nicer printing.
Contact
Compose a friendly e-mail to Matthias.Bogaert@UGent.Be.