title: C# - R interface
body: <p>I need to interface R to some C# application. I installed <code>rscproxy_1.3</code> and <code>R_Scilab_DCOM3.0-1B5</code> added COM references to the <code>STATCONNECTORCLNTLib</code>, <code>StatConnectorCommonLib</code> and <code>STATCONNECTORSRVLib</code> but I still cannot get it working. </p>
  
  <p>When I run following test program: </p>
  
  <pre><code>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");
          }
      }
  }
  </code></pre>
  
  <p>I get this exception:</p>
  
  <pre><code>Unhandled Exception: System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80040013
     at STATCONNECTORSRVLib.StatConnectorClass.Init(String bstrConnectorName)
  </code></pre>
  
  <p>Thanks in advance.</p>
  
  <p><strong>UPDATE:</strong>
  Ok, still no luck.
  I will try to explain what I did so far.</p>
  
  <blockquote>
    <p>Installed R-2.12.2-win.exe from
    rproject to the <code>C:\Program
    Files\R\R-2.12.2</code></p>
    
    <p>Downloaded rscproxy_1.3-1.zip and
    copy/pasted it to the <code>C:\Program
    Files\R\R-2.12.2\library</code></p>
    
    <p>Installed R_Scilab_DCOM3.0-1B5.exe to
    the <code>C:\Program Files (x86)\R\(D)COM
    Server</code></p>
  </blockquote>
  
  <p>With Scilab comes a basic test. I tried to run it but I got following error:</p>
  
  <blockquote>
    <p>Loading StatConnector Server... Done
    Initializing R...Function call failed 
    Code: -2147221485   Text: installation
    problem: unable to load connector
    Releasing StatConnector Server...Done</p>
  </blockquote>
  
  <p>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. </p>
  
  <p>I guess I am doing something terribly wrong, so I desperately need help from you guys.  </p>