C# - R的接口 [英] C# - R interface
问题描述
我需要接口R一些C#应用程序。我安装了 rscproxy_1.3
和 R_Scilab_DCOM3.0-1B5
添加COM引用到 STATCONNECTORCLNTLib
, StatConnectorCommonLib
和 STATCONNECTORSRVLib
,但我仍然不能得到它的工作。
在我运行下面的测试程序:
使用系统;
使用System.Collections.Generic;
使用System.Linq的;
使用System.Text;// COM引用
使用STATCONNECTORCLNTLib;
使用StatConnectorCommonLib;
使用STATCONNECTORSRVLib;命名空间R_TESTING
{
类节目
{
静态无效的主要(字串[] args)
{
StatConnector SC1 =新STATCONNECTORSRVLib.StatConnectorClass();
sc1.Init(R);
}
}
}
我得到这个异常:
未处理的异常信息:System.Runtime.InteropServices.COMException:从HRESULT异常:0x80040013
在STATCONNECTORSRVLib.StatConnectorClass.Init(字符串bstrConnectorName)
先谢谢了。
更新:
好了,仍然没有运气。
我会尽量解释什么,我做了这么远。</ P>
安装了R-2.12.2-win.exe将
rproject到C:\\ PROGRAM
文件\\ r \\ R-2.12.2
下载rscproxy_1.3-1.zip和
复制/粘贴文本到C:\\ PROGRAM
文件\\ r \\ R-2.12.2 \\库
安装R_Scilab_DCOM3.0-1B5.exe到
在C:\\ Program Files文件(x86)的\\ r \\(D)COM
服务器
块引用>通过自带的Scilab一个基本的测试。我试着运行它,但我得到了以下错误:
加载StatConnector服务器...已完成
初始化 - [R ...函数调用失败
code:-2147221485文字:安装
问题:无法加载连接器
释放StatConnector服务器...完成
块引用>比我看着在PATH /系统变量并没有发现路径/ R_HOME / R_USER信息。另外,我找不到在注册表中相关的任何R上。
我想我做一些可怕的错误,所以我迫切需要从你们的帮助。
解决方案好吧,我解决了它最后。
问题是,R(D)COM不符合我安装了2.11.1 R.当前版本的工作,它的工作盒。非常感谢。
I need to interface R to some C# application. I installed
rscproxy_1.3
andR_Scilab_DCOM3.0-1B5
added COM references to theSTATCONNECTORCLNTLib
,StatConnectorCommonLib
andSTATCONNECTORSRVLib
but I still cannot get it working.When I run following test program:
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"); } } }
I get this exception:
Unhandled Exception: System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80040013 at STATCONNECTORSRVLib.StatConnectorClass.Init(String bstrConnectorName)
Thanks in advance.
UPDATE: Ok, still no luck. I will try to explain what I did so far.
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
With Scilab comes a basic test. I tried to run it but I got following error:
Loading StatConnector Server... Done Initializing R...Function call failed Code: -2147221485 Text: installation problem: unable to load connector Releasing StatConnector Server...Done
Than I looked in the PATH/System Variables and found no path/R_HOME/R_USER info. Also, I couldn't find anything R related in the registry.
I guess I am doing something terribly wrong, so I desperately need help from you guys.
解决方案Ok, I solved it finally. The problem is that R (D)Com doesn't work with current version of R. I installed 2.11.1 and it worked out of box.
Thanks a lot.
这篇关于C# - R的接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!