Skip to content
hmansell edited this page Aug 1, 2012 · 4 revisions

How do we call into R?

The RProvider loads the R.DLL (which contains the core of R) into the calling process, via RDotNet. This will happen in several places:

  • In the IDE, to provide IntelliSense for packages/functions/parameters.
  • In the F# compiler, to generate code that calls the R functionality you are calling.
  • In your resulting binary, to execute the generated code.
  • In F# Interactive, to do all of the above interactively.

How does RDotNet help?

RDotNet allows R functionality to be called from .NET, and exposes an object model for representing R values (based on the type RDotNet.SymbolExpression). Using RDotNet, one executes R code by passing strings of R code into an Evaluate method. From the RProvider, we introspect on available R packages and functions and expose them as members of provided types. You can then call them just like regular .NET functions, with IntelliSense and compile-time checking. RDotNet.SymbolicExpression provides a nice OO model of the R native SEXP type, so we simply expose results using that type. To make it more friendly from F#, we extend it with some extension members and active patterns.

Clone this wiki locally