我需要将 R 连接到某些 C# 应用程序。我安装了 rscproxy_1.3
和 R_Scilab_DCOM3.0-1B5
添加了对 STATCONNECTORCLNTLib
、StatConnectorCommonLib
和 的 COM 引用>STATCONNECTORSRVLib
但我仍然无法让它工作。
当我运行以下测试程序时:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//COM references
using STATCONNECTORCLNTLib;
using StatConnectorCommonLib;
using STATCONNECTORSRVLib;
namespace R_TESTING
{
class Program
{
static void Main(string[] args)
{
StatConnector sc1 = new STATCONNECTORSRVLib.StatConnectorClass();
sc1.Init("R");
}
}
}
我得到这个异常:
Unhandled Exception: System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80040013
at STATCONNECTORSRVLib.StatConnectorClass.Init(String bstrConnectorName)
提前致谢。
更新: 好的,仍然没有运气。 我将尝试解释我到目前为止所做的事情。
Installed R-2.12.2-win.exe from rproject to the
C:\Program Files\R\R-2.12.2
Downloaded rscproxy_1.3-1.zip and copy/pasted it to the
C:\Program Files\R\R-2.12.2\library
Installed R_Scilab_DCOM3.0-1B5.exe to the
C:\Program Files (x86)\R\(D)COM Server
Scilab 附带一个基本测试。我尝试运行它,但出现以下错误:
Loading StatConnector Server... Done Initializing R...Function call failed Code: -2147221485 Text: installation problem: unable to load connector Releasing StatConnector Server...Done
然后我查看了 PATH/系统变量,没有发现路径/R_HOME/R_USER 信息。另外,我在注册表中找不到任何与 R 相关的内容。
我想我做错了什么,所以我迫切需要你们的帮助。
最佳答案
你可以看看R.NET , 对于另一种方法...
关于C# - R 界面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5377070/