一、C++代码1.cpp
#include
#include
#include
using namespace std;
int main(int argc,char* argv[])
{
RInside R(argc,argv);//创建一个R环境
string cmdStr;//R命令行变量
cout << "******* test R basic data type *******" << endl;
cmdStr = "m
double d1 = Rcpp::as(R.parseEval(cmdStr));//将R命令结果解析赋值给d1
cout << "d1 = " << d1 << endl;
cmdStr = "str
string str = Rcpp::as(R.parseEval(cmdStr));//将R命令结果解析赋值给str
cout << "str = " << str << endl;
cmdStr = "b
bool b = Rcpp::as(R.parseEval(cmdStr));
cout << boolalpha << "b = " << b << endl;
cout << "******* test R vector *******" << endl;
cmdStr = "M
vec