Fast and Functional Data Structures
Overview
Provides fast, side-effect free data structures, including catenable named lists, priority queues, double-ended queues, ordered sequences, and interval indices. Implementation is based on the finger-tree data structure of Hinze and Paterson (2006) doi:10.1017/S0956796805005769.
Deprecated
peek_overlaps(),peek_all_overlaps(),pop_overlaps(), andpop_all_overlaps()are renamed topeek_overlapping(),peek_all_overlapping(),pop_overlapping(), andpop_all_overlapping(). The new names matchpeek_containing()and make clear that the non-allversions return a single match. The old names still work but emit a deprecation warning, and will be removed in a future release.
New features
pop_front(),pop_back(), andpop_at()on anordered_sequencenow return the popped element'skeyalongsidevalueandremaining(NULLon a miss), matchingpop_key(),pop_min(), and the intervalpop_*helpers. Plainflexseqpops are unchanged.
Show all changes in 1.2.0Hide the rest of the changes in 1.2.0
- New
key_at()reads the key of anordered_sequenceelement at a given one-based position without removing it (the positional companion topeek_at(), and the general form ofmin_key()/max_key()). - New
nearest_key()returns the existing key closest to a query key, composing withpeek_key()/pop_key(). It resolves by order alone at the extremes and on an exact hit (any key type), and usesabs(query - key)when the query falls strictly between two distinct keys (numeric/Date/POSIXct). Thetiesargument resolves an equidistant tie between two distinct keys:"lower"(default),"upper", or"both"(returns both keys). It errors for non-subtractable keys (e.g.character) in that between case, where "closer" is undefined.
Performance
ordered_sequencekey-boundary lookups now use a native C++ descent fornumeric,character, andlogicalkeys, speeding uplower_bound(),upper_bound(),peek_key(),pop_key(),peek_all_key(),pop_all_key(),count_key(),elements_between(), andcount_between().- The implementation now uses lazy evaluation matching the Hinze and Paterson reference implementation, making amortized-constant-time end access claims true when structures are used in a persistent setting.
Documentation and fixes
- Minor documentation improvements
- Trimming of unit tests to speed check times on CRAN machines
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK5 OK2026-04-29
Documentation
The repository also keeps web-only articles.
- Help pages
- 104 (7 internal)includes a package overview page
- Examples that run
- 100%98 run in a plain check (1 of them under a condition)
- Exported functions with examples
- 99%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 0%
- Benchmarking Immutables Against Base R and Alternatives HTML
- Developer API: Building Structures on Monoid-Annotated Finger Trees HTML
- Flexible Sequences: Persistent Lists, Deques, and Slicing HTML
- Immutables: Fast, Persistent Data Structures for R HTML
- Interval Indices: Overlap and Containment Queries HTML
- Ordered Sequences: Key-Sorted Storage with Range Queries HTML
- Priority Queues: Fast Min/Max Access by Priority HTML
Downloads
Repository
- PRs merged (all time)
- 100%
- Median days to close, 50 most recently updated closed issues
- not measured
- Median days to close, 50 most recently updated closed PRs
- 0
Releases over time
PRs over time
Commits over time
10 development-tooling and community-health practices detected across 6 families in the upstream repository
Checks run against github.com/oneilsh/immutables on 2026-10-21.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-10-12 · The repository has a site deploy workflow
pkgdown site last built 2026-10-12
Show all practicesHide 2 practices
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2026-02-15Named in .Rbuildignore: .claudeNamed in .gitignore: .claudeCommits: at least 12 crediting it in the message
- Gemini CLIfirst seen 2026-02-18Config: a file or ignore line, not recorded which
- Codexfirst seen 2026-04-16Named in .Rbuildignore: .codexNamed in .gitignore: .codex
- Claude Opus 5.59 commits · Sep 2026
- Claude Opus 4.83 commits · Sep 2026
Dependencies
Code & Tests
Datasets
People & History
Package metadata
- First published
- 2026-04-28
- Total releases
- 3 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.1.0
- Download size
- 822 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("Immutables")The package provides a citation file that builds its entry when R runs it. Run citation() to see it.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.