RInside 和 Rcpp 的区别 [英] Difference between RInside and Rcpp
问题描述
我了解 RInside 允许 C++ 程序嵌入 R 代码,而 Rcpp 允许 R 代码调用 C++ 函数或库.
I understand RInside allows C++ program to embed R code, while Rcpp enables R code to call C++ functions or library.
RInside 和 Rcpp 之间是否存在其他差异和共性?为什么 RInside 有一个名为 Rcpp 的命名空间?开发者是否总是需要 RInside 和 Rcpp 来调用 R 代码作为 Cpp 中的一个类?
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?
推荐答案
Rcpp:
Rcpp 包提供了 R 函数和一个 C++ 库,以促进 R 和 C++ 的集成.
The Rcpp package provides R functions and a C++ library facilitating the integration of R and C++.
RInside 包提供了一些类,用于通过依赖 Rcpp 将 R 无缝嵌入到 C++ 应用程序中.
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++ 中.
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++.
这篇关于RInside 和 Rcpp 的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!