Advanced and Fast Data Transformation
Overview
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) doi:10.18637/jss.v116.i01.
- Fixed a bug in
setv()/copyv()where assignments into character (STRSXP) or list (VECSXP) vectors bypassed R's generational write barrier, writing element pointers directly instead of usingSET_STRING_ELT()/SET_VECTOR_ELT(). This could cause an old-generation target to hold an unrecorded reference to a younger value, which a subsequent young-generation garbage collection could free while still referenced, leading to memory corruption, crypticCHAR()/SET_STRING_ELT()errors, or segfaults, most likely under heavy allocation in long-running processes. Thanks @SebKrantz for reporting and diagnosing (#876). - Fixed a bug in
fmatch()(and thus%in%/%!in%/%iin%/%!iin%and joins) where a logicalNAinxcould spuriously match a non-NAvalue intable(e.g.2L) whentablewas not itself logical. Thanks @LJ-Jenkins for reporting (#870). - Fixed a bug in
fslice()(grouped,n = 1,with.ties = FALSE) that caused R to crash with a fatal error when a group had only missing values inorder.by. Thanks @chihyunkim for reporting (#867).
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK12 OK2026-04-25
- NOTE11 OK, 3 NOTE2026-04-22
- ERROR10 OK, 3 NOTE, 1 ERROR2026-04-18
Show 1 earlier changeHide 1 earlier change
- NOTE11 OK, 3 NOTE2026-03-10
Documentation
- Help pages
- 82includes a package overview page
- Examples that run
- 100%73 run in a plain check
- Exported functions with examples
- 94%
- Documented parameters
- 85%
- Return-value docs
- 90%
- Help pages citing references
- 28%
Downloads
Repository
- PRs merged (all time)
- 94%
- Median days to close, 50 most recently updated closed issues
- 4
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
Commits over time
12 development-tooling and community-health practices detected across 7 families in the upstream repository
Checks run against github.com/fastverse/collapse on 2026-10-18.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-09-17 · The repository has a site deploy workflow
pkgdown site last built 2026-09-17
Show all practicesHide 3 practices
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2026-03-27Seen in the repository: CLAUDE.mdNamed in .Rbuildignore: .claude, CLAUDE.mdPull request it wrote: opened by a project memberCommits: 5 by its own account · at least 3 crediting it in the message
- Cursorfirst seen 2026-05-17Pull request it wrote: opened by a project memberCommits: at least 4 crediting it in the message
- Claude CodePull requests: 1 from outside contributors, first on 2026-09-23, 1 from forks
- Claude Sonnet 4.52 commits · May 2026
Dependencies
Installing collapse adds 1 package (1 with compiled code, 1.8 MB of source tarballs). Heaviest: Rcpp 1.8 MB.
Show the 48 most downloaded dependentsHide the 48 most downloaded dependents
Code & Tests
Datasets
People & History
Show 1 more contributorHide 1 contributor
Pick two releases to compare their code metrics.
- 2.1.8Latest
- 2.1.72026-05-19 · diff ↗
- RR 4.6.0 released · 2026-04-24
- 2.1.62026-01-11 · diff ↗
- 2.1.52025-11-19 · diff ↗
- 2.1.42025-10-24 · diff ↗
- 2.1.32025-08-18 · diff ↗
- 2.1.22025-05-25 · diff ↗
- 2.1.12025-04-14 · diff ↗
- RR 4.5.0 released · 2025-04-11
- 2.1.02025-03-10 · diff ↗ ·
removed 12 exports
as.factor_GRP, as.factor_qG, Date_vars, `Date_vars<-`, is.categorical, is.Date, is.GRP, is.qG, is.unlistable, pwNobs, as.numeric_factor, as.character_factoradded 3 exports
fslice, fslicev, groupv - 2.0.192025-01-09 · diff ↗
- 2.0.182024-11-23 · diff ↗
- 2.0.172024-11-03 · diff ↗
- 2.0.162024-08-21 · diff ↗
- 2.0.152024-07-08 · diff ↗
Show 52 earlier eventsHide 52 earlier events
- 2.0.14
- RR 4.4.0 released · 2024-04-24
- 2.0.132024-04-14 · diff ↗
- 2.0.122024-04-01 · diff ↗
- 2.0.112024-03-21 · diff ↗
- 2.0.102024-02-17 · diff ↗
- 2.0.9
- 2.0.7
- 2.0.62023-11-12 · diff ↗
- 2.0.32023-10-18 · diff ↗
- 2.0.22023-10-14 · diff ↗ ·
added 8 exports
pivot, vec, join, fmatch, `%iin%`, `%!iin%`, rowbind, .COLLAPSE_OLD - 1.9.62023-05-28 · diff ↗
- RR 4.3.0 released · 2023-04-21
- 1.9.52023-04-07 · diff ↗
- 1.9.42023-03-31 · diff ↗
- 1.9.3
- 1.9.2
- 1.9.02023-01-15 · diff ↗ ·
removed 13 exports
F, fNdistinct.data.frame, fNdistinct.default, fNdistinct.matrix, fNobs.data.frame, fNobs.default, fNobs.matrix, fHDbetween.default, fHDbetween.matrix, fHDbetween.data.frame, fHDwithin.default, fHDwithin.matrix, fHDwithin.data.frameadded 8 exports
fsummarize, GRPid, fcount, fcountv, descr.default, fquantile, .quantile, fdist - 1.8.9
- 1.8.8
- 1.8.62022-06-14 · diff ↗
- 1.8.52022-06-13 · diff ↗
- 1.8.42022-06-08 · diff ↗ ·
removed 3 exports
is.regular, Recode, replace_non_finiteadded 16 exports
timeid, is_irregular, findex_by, iby, findex, ix, reindex, unindex, to_plm, qtab, qtable, greorder, setTRA, vgcd, frange, fnunique - RR 4.2.0 released · 2022-04-22
- 1.7.6
- 1.7.52022-02-03 · diff ↗
- 1.7.32022-01-26 · diff ↗
- 1.7.22022-01-23 · diff ↗
- 1.7.02022-01-14 · diff ↗ ·
added 23 exports
fmutate, mtt, gsplit, vlengths, whichv, `%==%`, `%!=%`, whichNA, copyv, setv, setop, `%+=%`, `%-=%`, `%*=%`, `%/=%`, allv, anyv, massign, `%=%`, rnm, relabel, setrelabel, group - 1.6.52021-07-24 · diff ↗
- 1.6.42021-07-13 · diff ↗
- 1.6.2
- 1.6.02021-06-28 · diff ↗ ·
added 34 exports
as_factor_GRP, as_factor_qG, date_vars, `date_vars<-`, fcumsum, fcumsum.data.frame, fcumsum.default, fcumsum.matrix, fndistinct, fndistinct.data.frame, fndistinct.default, fndistinct.matrix, fnobs, fnobs.data.frame, fnobs.default, fnobs.matrix, fhdbetween, fhdbetween.default, fhdbetween.matrix, fhdbetween.data.frame, fhdwithin, fhdwithin.default, fhdwithin.matrix, fhdwithin.data.frame, is_categorical, is_date, is_GRP, is_qG, is_unlistable, pwnobs and 4 more - RR 4.1.0 released · 2021-05-18
- 1.5.32021-03-07 · diff ↗
- 1.5.2
- 1.5.12021-01-12 · diff ↗
- unarchivedReturned to CRAN2021-01-04
- 1.5.02021-01-04 · diff ↗ ·
added 12 exports
allNA, missing_cases, `%rr%`, `%r+%`, `%r-%`, `%r*%`, `%r/%`, `%cr%`, `%c+%`, `%c-%`, `%c*%`, `%c/%` - archivedRemoved from CRAN2020-12-19check problems were not corrected in time
- 1.4.22020-11-10 · diff ↗
- 1.4.12020-11-09 · diff ↗
- 1.4.02020-11-01 · diff ↗ ·
removed 2 exports
as.factor.GRP, group_names.GRPadded 13 exports
gby, flm, cinv, qTBL, rsplit, rsplit.default, rsplit.data.frame, fdroplevels, fdroplevels.factor, fdroplevels.data.frame, setAttrib, copyAttrib, copyMostAttrib - 1.3.2
- 1.3.12020-08-27 · diff ↗
- 1.3.02020-08-11 · diff ↗ ·
added 21 exports
as.factor_GRP, as.factor_qG, `ftransform<-`, `tfm<-`, fnth, fnth.data.frame, fnth.default, fnth.matrix, gvr, `gvr<-`, fungroup, GRPnames, .c, roworder, roworderv, frename, setrename, colorder, colorderv, funique.default, funique.data.frame - 1.2.12020-05-27 · diff ↗
- 1.2.02020-05-19 · diff ↗ ·
added 36 exports
fselect, slt, `fselect<-`, `slt<-`, ss, fsubset, sbt, fsubset.data.frame, fsubset.default, fsubset.matrix, ftransform, tfm, settransform, settfm, fcompute, Dlog, varying, varying.data.frame, varying.default, varying.matrix, radixorder, radixorderv, seqid, groupid, fgroup_by, fgroup_vars, is.qG, unattrib, na_omit, recode_num and 6 more - RR 4.0.0 released · 2020-04-24
- 1.1.0
- 1.0.02020-03-19
- RR 3.6.0 released · 2019-04-26
Package metadata
- First published
- 2020-03-19
- Total releases
- 58 / 6 yrs
- License
- GPL (>= 2) | file LICENSE OSI
- Minimum R
- ≥ 4.1.0
- Bundled data
- 571 KB / 2 files
- Download size
- 1.4 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("collapse")The package provides a citation file that builds its entry when R runs it. Run citation() to see it.
The repository also keeps a CITATION.cff.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-22, which the citation names so these numbers can be found later. More on citing and the projects behind them.