collapse Documentation and Resources

Sebastian Krantz


collapse is a C/C++ based package for data transformation and statistical computing in R. It’s aims are:

  1. To facilitate complex data transformation, exploration and computing tasks in R.
  2. To help make R code fast, flexible, parsimonious and programmer friendly.

It is among the fastest and most broadly compatible, but also one of the most thoroughly documented packages on CRAN. Documentation comes in 4 different forms:

Built-In Structured Documentation

After installing collapse, you can call help("collapse-documentation") which will produce a central help page providing a broad overview of the entire functionality of the package, including direct links to all function documentation pages and links to 11 further topical documentation pages describing how clusters of related functions work together. The names of these additional help pages are contained in a global macro .COLLAPSE_TOPICS and can so easily be called from the R console as well. Function documentation is interlinked with the relevant topical pages, and all documentation pages link back to the central overview page at help("collapse-documentation").

Thus collapse comes with a fully structured hierarchical documentation which you can browse within R - and you don’t require anything else to fully understand this package. The Documentation is also available online.

In addition, the package page under help("collapse-package") provides some more general information about the package and its design philosophy, as well as a very compact set of examples covering most of the important functionality.

Reading help("collapse-package") and help("collapse-documentation") and working through the examples on help("collapse-package") is probably the fastest way to get acquainted with the package.


There are also 4 vignettes which are available online (due to their size and the enhanced browsing experience on the website). The vignettes are:


I maintain a blog linked to where I introduced collapse with some compact posts covering central functionality. Among these, the post about programming with collapse is highly recommended for ambitious users and developers willing to build on collapse, as it exposes to some degree how central parts of collapse work together and provides tips on how to write very efficient collapse code. Future blog posts will expose some specialized functionality in more detail.


Finally, there is a cheatsheet at Rstudio that compactly summarizes the collapse function space, similar to help("collapse-documentation").