|File Search||Catalog||Content Search|
R data types (SEXP) are matched to C++ objects in a class hierarchy. All R types are supported (vectors, functions, environment, etc ...) and each type is mapped to a dedicated class. For example, numeric vectors are represented as instances of the Rcpp::NumericVector class, environments are represented as instances of Rcpp::Environment, functions are represented as Rcpp::Function, etc ...
The underlying C++ library also offers the Rcpp::wrap function which is a templated function that transforms an arbitrary object into a SEXP. This makes it straightforward to implement C++ logic in terms of standard C++ types such as STL containers and then wrap them when they need to be returned to R. Internally, wrap uses advanced template meta programming techniques and currently supports : primitive types (bool, int, double, size_t, Rbyte, Rcomplex, std::string), STL containers (e.g std::vector<T>) where T is wrappable, STL maps (e.g std::map<std::string,T>) where T is wrappable, and arbitrary types that support implicit conversion to SEXP.
The reverse conversion (from R to C++) is performed by the Rcpp::as function template offering a similar degree of flexibility.
The package also contains a set of classes---which we call the `classic Rcpp API'---that were provided in an earlier API for R and C++ integration. Due to its continued use, the classic API is retained and will be supported for the foreseable future. The classic API includes support for R types real, integer, character, vector, matrix, Date, datetime (i.e. POSIXct) at microsecond resolution, data frame, and function. Transfer to and from simple or complex SEXP objects is made easy thanks to automatic conversion made possible by C++ template conversion. Calling R functions from C++ is also supported.
C++ code can be 'inlined' by using the 'inline' package which will create a C++ function and compile, link and load it given the 'inlined' character argument which makes C++ integration very easy.
Several examples are included, and 735 unit tests in 329 functions provide addtional usage examples.
History ======= Rcpp continues and extends earlier work by Dominik Samperi which he initially contributed directly into the RQuantLib package. Then, during 2005 and 2006, several releases were made as CRAN packages, first under the name Rcpp and later under the name RcppTemplate. However, both packages were left abandonded after November 2006. Later, in November 2009, two brief releases were m more»
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 more»
0.8.5 2010-07-25 o speed improvements. Vector::names, RObject::slot have been improved to take advantage of R API functions instead of callbacks to R o Some small updates to the Rd-based documentation which now points to content in the vignettes. Also a small formatting change to suppress a warning from the development version of R. o Minor changes to Date more»
2010-07-25 Dirk Eddelbuettel <firstname.lastname@example.org> * DESCRIPTION: Release 0.8.5 * debian/*: Similar more»
rcpp (0.8.5-1) unstable; urgency=low * New release -- Dirk Eddelbuettel <email@example.com> Sun, more»
Documentation o Bring "Rcpp ? NumericVector" into life. The hook is in place, we just need more»
In alphabetical order: Laurent Gautier for help on R internals Alistair Gee for a patch m more»
This is the Debian GNU/Linux r-cran-rcpp package of Rcpp, an R / C++ interface package. Rcpp was wri more»