0

I understand RInside allows C++ program to embed R code, while Rcpp enables R code to call C++ functions or library.

Are there other differences and commonalities between RInside and Rcpp? Why RInside has a namespace called Rcpp? Do developers always need both RInside and Rcpp to call R code as a class in Cpp?

SimonInNYC
  • 400
  • 3
  • 15

1 Answers1

2

Rcpp:

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

RInside:

The RInside package provides a few classes for seamless embedding of R inside of C++ applications by relying on Rcpp.

So it appears the Rcpp is lower level and facilities the communication between the two languages, not just from R to C++ as you state but communication in both directions. RInside, on the other hand, is higher level library built on top of Rcpp focused on easy embedding of R into C++.

Mark
  • 106,305
  • 20
  • 172
  • 230
  • Is Rcpp already included in RInside? Let's say I want to embed some R modules in my C++ application, do I need to install both RInside and Rcpp? – SimonInNYC Nov 03 '17 at 15:51
  • 2
    @GTWu, are you installing through CRAN? If so, RCpp is a [dependency](https://cran.r-project.org/package=RInside) of RInside, install one and you get the other... – Mark Nov 03 '17 at 16:34