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 < http://gallery.rcpp.org>, the paper by Eddelbuettel and Francois (2011, JSS), and the book by Eddelbuettel (2013, Springer); see 'citation("Rcpp")' for details on these last two.


The Rcpp package provides R functions and a C++ library facilitating the integration of R and C++.

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 Rcpp-introduction vignette (also published as a JSS paper) provides a good entry point to Rcpp as do the Rcpp website, the Rcpp page and the Rcpp Gallery. Full documentation is provided by the Rcpp book.

Conversion from C++ to R and back is driven by the templates Rcpp::wrap and Rcpp::as which are highly flexible and extensible, as documented in the Rcpp-extending vignette.

Rcpp also provides Rcpp modules, a framework that allows exposing C++ functions and classes to the R level. The Rcpp-modules vignette details the current set of features of Rcpp-modules.

Rcpp includes a concept called Rcpp sugar that brings many R functions into C++. Sugar takes advantage of lazy evaluation and expression templates to achieve great performance while exposing a syntax that is much nicer to use than the equivalent low-level loop code. The Rcpp-sugar gives an overview of the feature.

Rcpp attributes provide a high-level syntax for declaring C++ functions as callable from R and automatically generating the code required to invoke them. Attributes are intended to facilitate both interactive use of C++ within R sessions as well as to support R package development. Attributes are built on top of Rcpp modules and their implementation is based on previous work in the inline package. See the Rcpp-atttributes vignettes for more details.

The package ships with nine pdf vignettes.

Additional documentation is available via the JSS paper by Eddelbuettel and Francois (2011, JSS) paper (corresponding to the 'intro' vignette) and the book by Eddelbuettel (2013, Springer); see 'citation("Rcpp")' for details.

The Rcpp Gallery showcases over 90 fully documented and working examples.

A number of examples are included as are over 920 unit tests in over 470 unit test functions provide additional usage examples.

The CRAN network contains (as of May 2015) over 380 packages which also provide usage examples, with another 50+ as part of BioConductor.

An earlier version of Rcpp, containing what we now call the 'classic Rcpp API' was written during 2005 and 2006 by Dominick Samperi. This code has been factored out of Rcpp into the package RcppClassic, and it is still available for code relying on the older interface. New development should always use this Rcpp package instead.

Other usage examples are provided by packages using Rcpp. As of July 2015, there are about 423 CRAN packages using Rcpp, a further 57 BioConductor packages as well as an unknown number of GitHub, Bitbucket, R-Forge, ... repositories using Rcpp.

Released and tested versions of Rcpp are available via the CRAN network, and can be installed from within R via

install.packages("Rcpp")

To install from source, ensure you have a complete package development environment for R as discussed in the relevant documentation; also see questions 1.2 and 1.3 in the Rcpp-FAQ.

Dirk Eddelbuettel, Romain Francois, JJ Allaire, Kevin Ushey, Qiang Kou, Doug Bates, and John Chambers

GPL (>= 2)

News

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("Rcpp")

0.12.6 by Dirk Eddelbuettel, a month ago


http://www.rcpp.org, http://dirk.eddelbuettel.com/code/rcpp.html, https://github.com/RcppCore/Rcpp


Report a bug at https://github.com/RcppCore/Rcpp/issues


Browse source code at https://github.com/cran/Rcpp


Authors: Dirk Eddelbuettel, Romain Francois, JJ Allaire, Kevin Ushey, Qiang Kou, Douglas Bates and John Chambers


Documentation:   PDF Manual  


Task views: High-Performance and Parallel Computing with R, Numerical Mathematics


GPL (>= 2) license


Imports methods, utils

Suggests RUnit, inline, rbenchmark, highlight, pkgKitten


Imported by ACEt, ADMMnet, AHR, ALKr, AbsFilterGSEA, AhoCorasickTrie, AlignStat, BAMMtools, BEDMatrix, BIFIEsurvey, BIPOD, BTLLasso, BTR, BWStest, BacArena, BalancedSampling, BayesComm, BayesFactor, BeviMed, BigQuic, BigVAR, CDF.PSIdekick, CDM, CFC, CIDnetworks, CMF, ChannelAttribution, ClustVarLV, CompGLM, CorReg, Countr, Coxnet, Cyclops, D3M, DDRTree, DLMtool, DNAprofiles, DNAtools, DStree, Delaporte, DescTools, DiffusionRgqd, DiffusionRimp, DiffusionRjgqd, EBMAforecast, ECctmc, ESGtoolkit, EWGoF, EloChoice, EstHer, FDRreg, FIACH, FIT, FLSSS, FastBandChol, FastGP, FeatureHashing, FunChisq, Funclustering, GAS, GCPM, GEEaSPU, GERGM, GMCM, GPareto, GPvam, GUILDS, GiRaF, Gmedian, GxM, HSAR, ICAOD, IHSEP, IRTpp, ISOpureR, IntegratedMRF, JSM, JacobiEigen, KernSmoothIRT, KernelKnn, Kmisc, LANDD, LaF, LambertW, Langevin, LassoBacktracking, Luminescence, MAT, MEGENA, MESS, MPTinR, MRS, MSGARCH, MTS, MatrixCorrelation, MediaK, MiSPU, ModelMetrics, Morpho, MultiBD, NAM, NHMM, NNLM, NetRep, OpenImageR, PAC, PAFit, PP, PPtreeViz, PReMiuM, PWD, PanelCount, PenCoxFrail, Pijavski, QRM, RInside, RLRsim, RNiftyReg, RProtoBuf, RPtests, RQuantLib, RSNPset, RSpectra, RStoolbox, RVowpalWabbit, Rankcluster, Rblpapi, RcppAPT, RcppAnnoy, RcppArmadillo, RcppBDT, RcppCCTZ, RcppCNPy, RcppClassic, RcppDE, RcppDL, RcppEigen, RcppExamples, RcppFaddeeva, RcppGSL, RcppGetconf, RcppHoney, RcppMLPACK, RcppNumerical, RcppProgress, RcppRedis, RcppRoll, RcppSMC, RcppShark, RcppStreams, RcppTOML, RcppZiggurat, RealVAMS, ReorderCluster, Rip46, Rlibeemd, RobustGaSP, Rphylopars, Rtsne, Ruchardet, Rvcg, Ryacas, SAMM, SBSA, SEERaBomb, SLOPE, SSL, SVMMatch, SciencesPo, SelvarMix, SimReg, SocialNetworks, SparseFactorAnalysis, SpatMCA, SpatPCA, SpatialEpi, SpatialTools, StatMethRank, StereoMorph, SuperRanker, TAM, TDA, TESS, TFMPvalue, TauStar, TransferEntropy, UncerIn2, V8, VIM, VNM, VarSelLCM, XBRL, aSPU, accelerometry, acebayes, alakazam, algstat, apcluster, arrApply, autovarCore, bWGR, batman, bayesm, bayou, bcp, bfa, bfp, bife, biglasso, bigmemory, biwavelet, blackbox, blockseg, bnnSurvival, bootTimeInference, btb, bvarsv, cIRT, catlearn, ccaPP, cccp, ccdrAlgorithm, cda, cgAUC, chopthin, cladoRcpp, classify, clere, climdex.pcic, clogitboost, clusrank, clusteval, coala, coneproj, contoureR, cord, crawl, creditr, ctmcd, cycleRtools, darch, datafsm, dbscan, ddR, ddalpha, deepboost, densityClust, dina, disclapmix, discretecdAlgorithm, diveRsity, diversitree, dnc, dplyr, dtwclust, easyVerification, eive, emil, evolqg, exif, extraDistr, fICA, fastAdaboost, fastM, fasteraster, fbroc, fdaMixed, fdapace, fdasrvf, feather, flam, flars, flip, forecast, forega, forestFloor, fourPNO, fourierin, fractional, fromo, futureheatwaves, fwsim, gRain, gRbase, gapfill, gaselect, gdm, gdtools, geiger, genie, geoCount, geohash, ggrepel, gjam, gkmSVM, glamlasso, glcm, glmBfp, glmmsr, gmum.r, gmwm, googleway, gpuR, graphicalVAR, grpSLOPE, gsEasy, h5, hashmap, haven, hawkes, hierarchicalSets, hit, hsphase, htmltools, httpuv, humaniformat, humarray, hunspell, hyphenatr, iBATCGH, iLaplace, ibm, icRSF, icamix, iccbeta, icd, icd9, icensmis, imager, immer, imputeMulti, inarmix, inca, indelmiss, iprior, iptools, isoph, iterpc, jiebaR, jmcm, jqr, jtGWAS, kamila, kdecopula, kernDeepStackNet, kmeans.ddR, l0ara, lamW, lasvmR, lbfgs, lcopula, lfl, lifecontingencies, lpme, lsbclust, lucr, magick, mapview, marked, markophylo, markovchain, matchingMarkets, mateable, maxent, mbbefd, mcIRT, mcPAFit, mcemGLM, mcga, mcmcse, metafolio, mets, mev, mgm, miceadds, microclass, milr, minimaxdesign, minqa, mirt, mirtCAT, miscset, missDeaths, mixedMem, mixpack, mkde, mlmc, mlxR, mmand, move, moveHMM, mp, mvabund, mvnfast, mwaved, myTAI, nabor, ndl, netcoh, netdiffuseR, neuroim, nmfgpu4R, noncompliance, oXim, odeintr, olctools, onlinePCA, ontologySimilarity, openair, openxlsx, optmatch, pROC, packcircles, pander, partialAR, pcIRT, pcalg, pdftools, pedometrics, penMSM, perccal, ph2bayes, ph2bye, phonics, phybreak, phylobase, phylocurve, phylosignal, plac, planar, plotSEMM, plyr, poisDoubleSamp, polyfreqs, polywog, prclust, precrec, primes, prodlim, prospectr, protViz, protolite, prototest, pryr, psd, purrr, pvar, pystr, qVarSel, quanteda, quantspec, qwraps2, rEDM, rPref, radiomics, randomUniformForest, ranger, rankdist, raster, rcss, readr, readstata13, readxl, reconstructr, recosystem, redist, relSim, rem, repolr, resemble, reshape2, revealedPrefs, rflann, rforensicbatwing, rgam, rgeolocate, ripa, rivr, rkvo, rmgarch, rmumps, rncl, robustreg, rococo, roll, rollply, rootWishart, roxygen2, rpg, rslp, rstan, rstpm2, rtk, rugarch, rvg, rwfec, rwirelesscom, saeRobust, saturnin, sbfc, sbmSDP, sbrl, scales, scorer, scoringRules, scrm, scrypt, sdcMicro, segmag, seqHMM, sgd, simPop, simmer, simstudy, sirt, sitmo, slfm, smoof, snowboot, snplist, sourceR, spBayesSurv, spaMM, sparseHessianFD, sparseLTSEigen, sparsereg, spatgraphs, spduration, spray, spsann, staTools, starma, stlplus, stm, stochvol, stocks, stosim, stplanr, stpm, strataG, stream, strum, survAccuracyMeasures, surveillance, surveybootstrap, svglite, synchronicity, synlik, synthACS, systemicrisk, tcR, tensorBSS, termstrc, text2vec, textmineR, textreg, textreuse, tibble, tidyr, timma, tmg, tmlenet, tnam, tokenizers, treeplyr, treescape, triebeard, tsBSS, tvd, tweenr, urltools, vcfR, velox, vita, wCorr, walkr, wand, webreadr, wordcloud, wordspace, wrswoR, xml2, yCrypticRNAs, yakmoR, yuima, zic.

Depended on by ASPBay, AdaptiveSparsity, Amelia, BaBooN, Biocomb, BuyseTest, CARBayes, CARBayesST, ClustMMDD, ClusterStability, ConConPiWiFun, CoxPlus, DeLorean, DepthProc, EPGLM, EditImputeCont, FBFsearch, FCNN4R, FDGcopulas, FRESA.CAD, FSInteract, GENLIB, GSE, GUTS, GeneticTools, GenomicTools, Gmisc, HUM, IBHM, IsingSampler, JAGUAR, MVB, MixedDataImpute, Mposterior, NPBayesImpute, NPflow, NetSim, OneArmPhaseTwoStudy, OpenMx, PACVB, PedCNV, PerMallows, PoweR, ProNet, ProbitSpatial, RSNNS, Rborist, Rclusterpp, RcppClassicExamples, RcppOctave, RcppXts, Rfast, Rmalschains, Rmixmod, RmixmodCombi, RoughSets, Rsomoclu, SOD, StMoSim, VideoComparison, bcpa, beanz, bifactorial, bigReg, blockmodels, clogitL1, collUtils, copCAR, cqrReg, dbmss, dendextendRcpp, dfpk, dils, drgee, dslice, ecp, eggCounts, emIRT, erah, fastGHQuad, fastR, flan, fugeR, gMWT, gaston, glmgraph, growcurves, growfunctions, hkevp, hypervolume, jmotif, kergp, lm.br, matchingR, mice, miscF, multicool, mvcluster, ngspatial, nonlinearTseries, oem, orQA, propagate, quadrupen, recmap, regsem, remote, rexpokit, robustgam, rotations, rstanarm, rtkore, rtkpp, satellite, sdcTable, seismicRoll, sequences, simFrame, snipEM, spacodiR, steadyICA, survSNP, tagcloud, tbart, treeclim, trustOptim, unmarked, waffect, wingui, wsrf.

Suggested by Rcereal, RcppParallel, crmPack, cxxfunplus, devtools, hyperSpec, ie2misc, iemisc, inline.

Linked to by Crossover, DetMCD, DetR, FastHCS, FastPCS, FastRCS, FisHiCal, HDPenReg, HLMdiag, MixAll, OjaNP, TAQMNGR, biganalytics, bigtabulate, blockcluster, btf, cpgen, dfcomb, dfmta, frailtySurv, gRim, hts, kmc, lme4, lsgl, msgl, psgp, rags2ridges, ragt2ridges, robustHD, sglOptim, signalHsmm.


See at CRAN