Project Description: R.NET is an in-process interoperability bridge to R from the .NET Framework. R.NET requires .NET Framework 4 and the native R DLLs installed with the R environment. R.NET works on Windows, Linux and MacOS.

To get started you should now head for the R.NET documentation on GiHub pages. The documentation on this Codeplex site is now legacy.

R.NET is now distributed via R.NET.Community on NuGet

News

2015-08-09:
2014-12-18 Release of the R package rClr 0.7-2 at rClr. This is a significant release due to the fact that all unit tests that can pass using Mono indeed pass.

2014-11-16 R.NET source code reference repository is now hosted on GitHub. This has been requested by several contributors amongst other things to facilitate pull requests.

2014-06-17 Thanks to Evelina Gabasova for documenting Setting up R.NET on Mac

Known Issues

Whetting the appetite


Program.cs
using System;
using System.Linq;
using RDotNet;

namespace Sample1
{
   class Program
   {
      static void Main(string[] args)
      {
         REngine.SetEnvironmentVariables();
         // There are several options to initialize the engine, but by default the following suffice:
         REngine engine = REngine.GetInstance();

         // .NET Framework array to R vector.
         NumericVector group1 = engine.CreateNumericVector(new double[] { 30.02, 29.99, 30.11, 29.97, 30.01, 29.99 });
         engine.SetSymbol("group1", group1);
         // Direct parsing from R script.
         NumericVector group2 = engine.Evaluate("group2 <- c(29.89, 29.93, 29.72, 29.98, 30.02, 29.98)").AsNumeric();

         // Test difference of mean and get the P-value.
         GenericVector testResult = engine.Evaluate("t.test(group1, group2)").AsList();
         double p = testResult["p.value"].AsNumeric().First();

         Console.WriteLine("Group1: [{0}]", string.Join(", ", group1));
         Console.WriteLine("Group2: [{0}]", string.Join(", ", group2));
         Console.WriteLine("P-value = {0:0.000}", p);

         // you should always dispose of the REngine properly.
         // After disposing of the engine, you cannot reinitialize nor reuse it
         engine.Dispose();

      }
   }
}

Related Projects