Project Description: R.NET enables the .NET Framework to interoperate with the R statistical language in the same process. R.NET requires .NET Framework 4 and the native R DLLs installed with the R environment. R.NET works on Windows, Linux and MacOS. Enjoy statistics and programming in your special language with R.

You should head for the documentation to get started with R.NET.


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

2014-05-23 Version 1.5.13 is available on Note that the package identifier is R.NET.Community

NuGet Packages

2014-12: After several releases in the R.NET 1.5 series, and related F# and graphics tools, the following location should be used to get the latest packages. Note that if you use the key R.NET instead of R.NET.Community you will also get the older package feeds.

Known Issues

  • There are persisting issues running R.NET from an ASP.NET application. The exact cause remains unclear, but this may be a inherent limitation of the R native engine with respect to thread safety.
  • Custom startup parameters when initializing the engine are ignored on Windows. The main drawback is memory limitations to 2GB. There will be at least a partial workaround for the next version.

Whetting the appetite

  • The example below gives a flavour of how R.NET works from C#. You should head for the documentation to really get started with R.NET. Examples of programming styles mixing C# and R are also available at the Examples page.

using System;
using System.Linq;
using RDotNet;

namespace Sample1
   class Program
      static void Main(string[] args)
         // 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


Related Projects

  • R to CLR: an R package to access .NET (CLR) objects from R, complementing R.NET. If you are looking to access .NET code from R interactively, you should consider this package.
  • F# R Provider: an F# library that provides static typed functions exposed by R packages, using the type provider mechanism of F#.

Last edited Dec 18, 2014 at 6:03 AM by jperraud, version 37