Learn R Programming

collapse (version 2.1.8)

Advanced and Fast Data Transformation

Description

A large C/C++-based package for advanced data transformation and statistical computing in R that is extremely fast, class-agnostic, robust, and programmer friendly. Core functionality includes a rich set of S3 generic grouped and weighted statistical functions for vectors, matrices and data frames, which provide efficient low-level vectorizations, OpenMP multithreading, and skip missing values by default. These are integrated with fast grouping and ordering algorithms (also callable from C), and efficient data manipulation functions. The package also provides a flexible and rigorous approach to time series and panel data in R, fast functions for data transformation and common statistical procedures, detailed (grouped, weighted) summary statistics, powerful tools to work with nested data, fast data object conversions, functions for memory efficient R programming, and helpers to effectively deal with variable labels, attributes, and missing data. It seamlessly supports base R objects/classes as well as 'units', 'integer64', 'xts'/ 'zoo', 'tibble', 'grouped_df', 'data.table', 'sf', and 'pseries'/'pdata.frame'. For a concise overview of the package see Krantz (2026) .

Copy Link

Version

Install

install.packages('collapse')

Monthly Downloads

40,706

Version

2.1.8

License

GPL (>= 2) | file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Sebastian Krantz

Last Published

August 30th, 2026

Functions in collapse (2.1.8)

BY

Split-Apply-Combine Computing
TRA

Transform Data by (Grouped) Replacing or Sweeping out Statistics
collapse-documentation

Collapse Documentation & Overview
GRP

Fast Grouping / collapse Grouping Objects
across

Apply Functions Across Multiple Columns
collapse-options

collapse Package Options
GGDC10S

Groningen Growth and Development Centre 10-Sector Database
collap

Advanced Data Aggregation
arithmetic

Fast Row/Column Arithmetic for Matrix-Like Objects
collapse-package

Advanced and Fast Data Transformation
descr

Detailed Statistical Description of Data Frame
collapse-renamed

Renamed Functions
fast-grouping-ordering

Fast Grouping and Ordering
dapply

Data Apply
fFtest

Fast (Weighted) F-test for Linear Models (with Factors)
data-transformations

Data Transformations
efficient-programming

Small Functions to Make R Programming More Efficient
colorder

Fast Reordering of Data Frame Columns
fast-data-manipulation

Fast Data Manipulation
get_elem

Find and Extract / Subset List Elements
fdroplevels

Fast Removal of Unused Factor Levels
fbetween-fwithin

Fast Between (Averaging) and (Quasi-)Within (Centering) Transformations
fcount

Efficiently Count Observations by Group
fcumsum

Fast (Grouped, Ordered) Cumulative Sum for Matrix-Like Objects
fdist

Fast and Flexible Distance Computations
fhdbetween-fhdwithin

Higher-Dimensional Centering and Linear Prediction
fast-statistical-functions

Fast (Grouped, Weighted) Statistical Functions for Matrix-Like Objects
fdiff

Fast (Quasi-, Log-) Differences for Time Series and Panel Data
ffirst-flast

Fast (Grouped) First and Last Value for Matrix-Like Objects
fgrowth

Fast Growth Rates for Time Series and Panel Data
fmatch

Fast Matching
fnobs

Fast (Grouped) Observation Count for Matrix-Like Objects
flm

Fast (Weighted) Linear Model Fitting
fprod

Fast (Grouped, Weighted) Product for Matrix-Like Objects
fndistinct

Fast (Grouped) Distinct Value Count for Matrix-Like Objects
fmin-fmax

Fast (Grouped) Maxima and Minima for Matrix-Like Objects
fmode

Fast (Grouped, Weighted) Statistical Mode for Matrix-Like Objects
fmean

Fast (Grouped, Weighted) Mean for Matrix-Like Objects
flag

Fast Lags and Leads for Time Series and Panel Data
fnth-fmedian

Fast (Grouped, Weighted) N'th Element/Quantile for Matrix-Like Objects
ftransform

Fast Transform and Compute Columns on a Data Frame
frename

Fast Renaming and Relabelling Objects
fsum

Fast (Grouped, Weighted) Sum for Matrix-Like Objects
fslice

Fast Slicing of Matrix-Like Objects
fquantile

Fast (Weighted) Sample Quantiles and Range
funique

Fast Unique Elements / Rows
fsubset

Fast Subsetting Matrix-Like Objects
fscale

Fast (Grouped, Weighted) Scaling and Centering of Matrix-like Objects
fsummarise

Fast Summarise
fvar-fsd

Fast (Grouped, Weighted) Variance and Standard Deviation for Matrix-Like Objects
join

Fast and Verbose Table Joins
pivot

Fast and Easy Data Reshaping
group

Fast Hash-Based Grouping
is_unlistable

Unlistable Lists
ldepth

Determine the Depth / Level of Nesting of a List
groupid

Generate Run-Length Type Group-Id
pad

Pad Matrix-Like Objects with a Value
indexing

Fast Indexed Time Series and Panels
list-processing

List Processing
psacf

Auto- and Cross- Covariance and Correlation Function Estimation for Panel Series
radixorder

Fast Radix-Based Ordering
qsu

Fast (Grouped, Weighted) Summary Statistics for Cross-Sectional and Panel Data
qF-qG-finteraction

Fast Factor Generation, Interactions and Vector Grouping
qtab

Fast (Weighted) Cross Tabulation
rapply2d

Recursively Apply a Function to a List of Data Objects
pwcor-pwcov-pwnobs

(Pairwise, Weighted) Correlations, Covariances and Observation Counts
rowbind

Row-Bind Lists / Data Frame-Like Objects
psmat

Matrix / Array from Panel Series
quick-conversion

Quick Data Conversion
recode-replace

Recode and Replace Values in Matrix-Like Objects
t_list

Efficient List Transpose
rsplit

Fast (Recursive) Splitting
fselect-get_vars-add_vars

Fast Select, Replace or Add Data Frame Columns
time-series-panel-series

Time Series and Panel Series
seqid

Generate Group-Id from Integer Sequences
timeid

Generate Integer-Id From Time/Date Sequences
summary-statistics

Summary Statistics
unlist2d

Recursive Row-Binding / Unlisting in 2D - to Data Frame
roworder

Fast Reordering of Data Frame Rows
small-helpers

Small (Helper) Functions
wlddev

World Development Dataset
varying

Fast Check of Variation in Data