0
我在R中绘制一个函数来绘制图形。我需要使用C++程序来调用这个函数。如何在C++中调用并传递参数给R函数?
ř计划(script.R)
genplot<-function(x,y,outfile)
{
plot(outfile)
plot(x,y)
dev.off()
}
C++程序(Run.cpp)
#include <iostream.h>
using namespace std;
int main()
{
int x[] = (1,2,3,4,5);
int y[] = (2,3,4,1,3);
genplot(x,y); #need to call r function by passing these 2 variables.
return 0;
}
请看使用[RServe](http://www.rforge.net/Rserve/doc.html)。配备C++客户端。 – Aert
@Alert这真的很有用,但没有示例显示如何在C++中使用它。你可以建议或张贴任何相同的例子。 – Manish