cpp4r: Header-Only 'C++' and 'R' Interface

Provides a header only, 'C++' interface to 'R' with enhancements over 'cpp11'. Enforces copy-on-write semantics consistent with 'R' behavior. Offers native support for ALTREP objects, 'UTF-8' string handling, modern 'C++' features and idioms, and reduced memory requirements. Allows for vendoring, making it useful for restricted environments. Compared to 'cpp11', it adds support for converting 'C++' maps to 'R' lists, 'Roxygen' documentation directly in 'C++' code, proper handling of matrix attributes, support for nullable external pointers, bidirectional copy of complex number types, flexibility in type conversions, use of nullable pointers, and various performance optimizations.

Version: 1.3.0
Depends: R (≥ 4.0.0)
Suggests: tinytest, rbibutils, litedown
Published: 2026-09-23
DOI: 10.32614/CRAN.package.cpp4r
Author: Mauricio Vargas Sepulveda ORCID iD [aut, cre], Posit Software, PBC [aut] (Original cpp11 package)
Maintainer: Mauricio Vargas Sepulveda <m.vargas.sepulveda at gmail.com>
BugReports: https://github.com/pachadotdev/cpp4r/issues
License: Apache License (≥ 2)
URL: https://cpp4r.org, https://github.com/pachadotdev/cpp4r
NeedsCompilation: no
Materials: NEWS
CRAN checks: cpp4r results

Documentation:

Reference manual: cpp4r.html , cpp4r.pdf
Vignettes: 01 - Introduction (source)
02 - Setup (source)
03 - Package Skeleton (source)
04 - Read-only versus Writable R Objects (source)
05 - Logical Functions (source)
06 - Rolling Functions (source)
07 - Statistical Functions (source)
08 - Logical Functions with Missing Values (source)
09 - Rolling Functions with Missing Values (source)
10 - Statistical Functions with Missing Values (source)
11 - Debugging R Packages (source)
12 - External Pointers (source)
13 - Compiler Optimizations (source)
14 - Linear Algebra (source)
15 - Internals (source)
16 - Worked Examples (source)
17 - FAQs (source)

Downloads:

Package source: cpp4r_1.3.0.tar.gz
Windows binaries: r-devel: cpp4r_1.1.0.zip, r-release: cpp4r_1.1.0.zip, r-oldrel: cpp4r_1.1.0.zip
macOS binaries: r-release (arm64): cpp4r_1.1.0.tgz, r-oldrel (arm64): cpp4r_1.1.0.tgz, r-release (x86_64): cpp4r_1.1.0.tgz, r-oldrel (x86_64): cpp4r_1.1.0.tgz
Old sources: cpp4r archive

Reverse dependencies:

Reverse imports: armadillo4r
Reverse linking to: capybara, economiccomplexity, kendallknight, later2, leontief, lotri, redatam, tinycache

Linking:

Please use the canonical form https://CRAN.R-project.org/package=cpp4r to link to this page.