det*_*pro 33 .net statistics compatibility interop r
我正在开发一个应用程序,它需要大量的stastical处理和输出作为.net桌面应用程序中的图像.这些问题,包括生成输出图像,似乎很适合R http://www.r-project.org/
是否有允许我从.net调用R的包装器,API,SDK或端口?
Mor*_*rly 14
R.NET是相当越野车与R的新版本如果它不工作的权利,它的工作原理非常(并将继续这样做,除非你确切地知道如何解决它).
就个人而言,我建议使用R脚本文件并执行它们.你应该做的是用你的R脚本开始
> sink()
> #set your working directory here with setwd()
> #your code comes in here
> sink(#name your output file here - could label it with a .txt if you please
+ )
Run Code Online (Sandbox Code Playgroud)
从.NET中,您必须通过键入包含System.Diagnostics名称空间using System.Diagnostics,然后编写以下代码:
string strCmdLine;
strCmdLine = "R CMD BATCH" + /* the path to your R script goes here */;
System.Diagnostics.Process.Start("CMD.exe",strCmdLine);
process1.Close();
Run Code Online (Sandbox Code Playgroud)
然后,您可以像这样使用StreamReader:
StreamReader ROutput = new StreamReader(/* your R output file's path should go here */)
Run Code Online (Sandbox Code Playgroud)
然后根据需要解析它(如果您需要帮助,请参阅RegEx和字符串的拆分方法).
希望这可以帮助!
Tho*_*att 11
我发现这个库更容易使用:
一些原因: