gpt4 book ai didi

c++ - RInside 和 Rcpp 的区别

转载 作者:行者123 更新时间:2023-11-28 01:41:10 26 4
gpt4 key购买 nike

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

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

最佳答案

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++ 中。

关于c++ - RInside 和 Rcpp 的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47098916/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com