1.参数传递看以下code,红色下划线处,分别是数据传入和传出,code来源:
http://joachimvandenbogaert.wordpress.com/2009/03/26/r-and-c-on-windows/
StatConnectorClass RConnector = new
StatConnectorClass();
RConnector.Init(“R”);
// Data we are going to pass
int n = 20;
// Cast C# type to R type
RConnector.SetSymbol(“n1″, n);
// The cast value n to n1 is now being used in R
RConnector.Evaluate(“x1 <- rnorm(n1)”);
// We get back the value of x1, but it needs to be cast
// to an array of doubles
object o = RConnector.GetSymbol(“x1″);
double[] random = (double[])o;
foreach (double d in random)
{
Console.WriteLine(d);
}
2.混合编程,编出的软件,R的code前提是必须能在R上能运行,然后转成.net代码。
3.自编的一个演示,功能不全,没有运用到两种语言数据的传递,但能实现C#界面,调用R,运行结果显示于C#所编界面。
程序是对package:kohonen data:wines数据进行聚类
界面由四个组件:两个RCOM图形插件,显示图形结果;一个RCOM文本插件,显示文本结果
以上为显示结果,RCOM图形插件显示图像并不清楚