RDotNet nullreference exception

129 views Asked by At

The line

REngine engine = REngine.GetInstance(null, true, rinit);

exception with NullReference. Not sure what I am doing wrong. I even tried the commented out version of getting the engine and that also doesn't work.

using RDotNet;
using System.IO;


namespace TestRDotNet
{
    class Program
    {
        static void Main(string[] args)
        {
            StartupParameter rinit = new StartupParameter();
            rinit.Quiet = true;
            rinit.RHome = "C:/Program Files/R/R-4.0.3";
            rinit.Interactive = true;
            REngine.SetEnvironmentVariables();

            // create one instance of RDotNet dll
            //var engine = REngine.GetInstance("C:/Program Files/R/R-4.0.3/bin/i386/R.dll", true, rinit);
            REngine engine = REngine.GetInstance(null, true, rinit);
1

There are 1 answers

0
Ian Botham On

I had the same problem. I reinstalled R - making sure I was using the correct 32/64 bit to match my code.

It worked after that. I don't have an answer. Just an anecdote.