An F# type provider for interoperating with R. For more information, see detailed documentation with tutorials, examples and more. The following tutorials are a good place to start:
The R Provider discovers R packages that are available in your R installation and makes them available as .NET namespaces underneath the parent namespace RProvider. For example, the stats package is available as RProvider.stats. If you open the namespaces you want to use, functions and values will be available as R.name.
| Package | Stable | Prerelease |
|---|---|---|
| RProvider |
RProvider is tested and supported for Windows 11 and macOS (apple silicon), but may work on older / other platforms.
Make sure the following requirements are installed on your system:
- dotnet SDK 10.0+; and
- R statistical language, version 4.5.0+.
Note: for classic .NET framework (v4) support, use the legacy RProvider 1.2 or earlier.
The R Provider discovers R packages that are available in your R installation and makes them available as .NET namespaces underneath the parent namespace RProvider. For example, the stats package is available as RProvider.stats. If you open the namespaces you want to use, functions and values will be available as R.name. For example, consider this F# interactive script:
#r "nuget:RProvider"
open RProvider
open RProvider.``base``
let v = R.c(1,2,3)This creates an R numeric vector containing 1,2,3, and names it v. Note that we had to open the base namespace, since the function 'c' is part of that namespace. You should also open namespace RProvider, because it contains some helper functions. As type providers are used by Visual Studio and other IDEs, you will get intellisense for R functions. You will also get compile-time type-checking that the function exists.
Note that you can set the version of RProvider to use (for reproducability) by changing the #r line to:
#r "nuget:RProvider,3.0.0" //replace 3.0.0 with desired versionRProvider is distributed as a NuGet package, which can be used from an F# script or F# projects. See the documentation for more detailed information.
Install the requirements listed in the above section. To build and test:
- Restore dotnet tools:
dotnet tool restore - Run FAKE:
dotnet fsi build.fsx
To debug, enable logging by setting the RPROVIDER_LOG environment value to an existing text file.
RProvider is covered by the BSD 2‑Clause license. The type provider depends on RBridge, which is MIT-licensed.
