Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
252 views
in Technique[技术] by (71.8m points)

C# - R interface

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 FilesRR-2.12.2

Downloaded rscproxy_1.3-1.zip and copy/pasted it to the C:Program FilesRR-2.12.2library

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can have a look at R.NET, for another approach...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...