collapse: Advanced and Fast Data Transformation

A C/C++ based package for advanced data transformation and statistical computing in R that is extremely fast, class-agnostic, and programmer friendly through a flexible and parsimonious syntax. It is well integrated with base R, 'dplyr' / (grouped) 'tibble', 'data.table', 'sf', 'plm' (panel-series and data frames), and non-destructively handles other matrix or data frame based classes (like 'ts', 'xts' / 'zoo', 'tsibble', ...) — Key Features: — (1) Advanced statistical programming: A full set of fast statistical functions supporting grouped and weighted computations on vectors, matrices and data frames. Fast and programmable grouping, ordering, unique values/rows, factor generation and interactions. Fast and flexible functions for data manipulation, data object conversions, and memory efficient R programming. (2) Advanced aggregation: Fast and easy multi-data-type, multi-function, weighted and parallelized data aggregation. (3) Advanced transformations: Fast row/column arithmetic, (grouped) replacing and sweeping out of statistics (by reference), (grouped, weighted) scaling/standardizing, (higher-dimensional) between (averaging) and (quasi-)within (demeaning) transformations, linear prediction, model fitting and testing exclusion restrictions. (4) Advanced time-computations: Fast and flexible indexed time series and panel data classes. Fast (sequences of) lags/leads, and (lagged/leaded, iterated, quasi-, log-) differences and (compounded) growth rates on (irregular) time series and panels. Multivariate auto-, partial- and cross-correlation functions for panel data. Panel data to (ts-)array conversions. (5) List processing: Recursive list search, splitting, extraction/subsetting, apply, and generalized row-binding / unlisting to data frame. (6) Advanced data exploration: Fast (grouped, weighted, panel-decomposed) summary statistics and descriptive tools.

Version: 1.8.9
Depends: R (≥ 3.3.0)
Imports: Rcpp (≥ 1.0.1)
LinkingTo: Rcpp
Suggests: fastverse, data.table, magrittr, kit, xts, zoo, plm, fixest, vars, RcppArmadillo, RcppEigen, tibble, dplyr, ggplot2, scales, microbenchmark, testthat, covr, knitr, rmarkdown
Published: 2022-10-07
Author: Sebastian Krantz [aut, cre], Matt Dowle [ctb], Arun Srinivasan [ctb], Morgan Jacob [ctb], Dirk Eddelbuettel [ctb], Laurent Berge [ctb], Kevin Tappe [ctb], R Core Team and contributors worldwide [ctb], Martyn Plummer [cph], 1999-2016 The R Core Team [cph]
Maintainer: Sebastian Krantz <sebastian.krantz at>
License: GPL-2 | GPL-3 | file LICENSE [expanded from: GPL (≥ 2) | file LICENSE]
NeedsCompilation: yes
SystemRequirements: C++11
Materials: NEWS
In views: Econometrics, OfficialStatistics, TimeSeries
CRAN checks: collapse results


Reference manual: collapse.pdf
Vignettes: collapse Documentation and Resources


Package source: collapse_1.8.9.tar.gz
Windows binaries: r-devel:, r-release:, r-oldrel:
macOS binaries: r-release (arm64): collapse_1.8.9.tgz, r-oldrel (arm64): collapse_1.8.9.tgz, r-release (x86_64): collapse_1.8.9.tgz, r-oldrel (x86_64): collapse_1.8.9.tgz
Old sources: collapse archive

Reverse dependencies:

Reverse imports: africamonitor, aorsf, blocs, dfms, DisImpact, fastverse, penppml, plm, summclust, ugatsdb
Reverse suggests: marginaleffects, ordbetareg


Please use the canonical form to link to this page.