Crandore Hub

Rcpp

Seamless R and C++ Integration

The 'Rcpp' package provides R functions as well as C++ classes which offer a seamless integration of R and C++. Many R data types and objects can be mapped back and forth to C++ equivalents which facilitates both writing of new code as well as easier integration of third-party libraries. Documentation about 'Rcpp' is provided by several vignettes included in this package, via the 'Rcpp Gallery' site at <https://gallery.rcpp.org>, the paper by Eddelbuettel and Francois (2011, <doi:10.18637/jss.v040.i08>), the book by Eddelbuettel (2013, <doi:10.1007/978-1-4614-6868-4>) and the paper by Eddelbuettel and Balamuta (2018, <doi:10.1080/00031305.2017.1375990>); see 'citation("Rcpp")' for details.

README

A much simpler version of the example is provided in the file newApiExample.r.
With littler installed, it can be run 'as is' as a shell script; else it can
be sourced into R.

 -- Dirk Eddelbuettel and Romain Francois,  06 Feb 2010


This directory provides a simple example of how an R function 
can be passed back and forth between R and C++.  

We define the function at the R level, pass it to C++ using the Rcpp
interface and have C++ call it.  This works by subclassing the C++ class
RcppFunction (from Rcpp) and adding a new member function transformVector()
which is vector-valued.  We then instantiate this new class in the C++
function called from R -- and by calling the transformVector() function from
C++ we get R to operate on the supplied vector.

In this demo, we simply exponeniate the data vector but also plot it as a
side effect -- effectively giving us R plotting from a C++ function.

 -- Dirk Eddelbuettel,  29 Sep 2009

Versions across snapshots

VersionRepositoryFileSize
1.1.1-1 latest linux/jammy R-4.5 Rcpp_1.1.1-1.tar.gz 2.1 MiB
1.1.1-1 latest source/ R- Rcpp_1.1.1-1.tar.gz 1.7 MiB
1.1.1-1 latest windows/windows R-4.5 Rcpp_1.1.1-1.zip 2.7 MiB
1.1.1-1 2026-04-18 linux/jammy R-4.5 Rcpp_1.1.1-1.tar.gz 2.1 MiB
1.1.1-1 2026-04-18 source/ R- Rcpp_1.1.1-1.tar.gz 1.7 MiB
1.1.1-1 2026-04-18 windows/windows R-4.5 Rcpp_1.1.1-1.zip 2.7 MiB
1.1.1 2026-04-12 linux/jammy R-4.5 Rcpp_1.1.1.tar.gz 2.1 MiB
1.1.1 2026-04-09 linux/jammy R-4.2 Rcpp_1.1.1.tar.gz 2.0 MiB
1.1.1 2026-04-09 linux/jammy R-4.5 Rcpp_1.1.1.tar.gz 2.1 MiB
1.1.1 2026-04-09 windows/windows R-4.2 Rcpp_1.1.1.zip 2.7 MiB
1.1.1 2026-04-09 windows/windows R-4.5 Rcpp_1.1.1.zip 2.7 MiB
1.0.8 2022-02-12 windows/windows R-4.1 Rcpp_1.0.8.zip 3.1 MiB

Dependencies (latest)

Imports

Suggests