RInside 和 Rcpp 的区别

Difference between RInside and Rcpp

我了解RInside 允许C++ 程序嵌入R 代码,而Rcpp 允许R 代码调用C++ 函数或库。

RInside 和 Rcpp 之间还有其他区别和共同点吗?为什么 RInside 有一个名为 Rcpp 的命名空间?开发人员是否总是需要 RInside 和 Rcpp 来调用 R 代码作为 Cpp 中的 class?

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.

所以看起来 Rcpp 是较低级别的,它促进了两种语言之间的交流,不仅仅是像你所说的从 R 到 C++,而是双向交流。另一方面,RInside 是建立在 Rcpp 之上的更高级别的库,专注于将 R 轻松嵌入到 C++ 中。