C# - R的接口 [英] C# - R interface

查看:448
本文介绍了C# - R的接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要接口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 =新STA​​TCONNECTORSRVLib.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 and R_Scilab_DCOM3.0-1B5 added COM references to the STATCONNECTORCLNTLib, StatConnectorCommonLib and STATCONNECTORSRVLib 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆