Working with the FsLab ecosystem

The R type provider is interoperable with other packages in FsLab through its plugin architecture. Some examples are shown below. If you would like to see better interoperability between R and other FsLab packages, submit an issue to their repository for the creation of an RProvider plugin.

Deedle - data frame manipulation

Deedle provides types for F# data frame and time series manipulation. To use with RProvider, first install the Deedle.RPlugin package from nuget; once this is installed, you do not need to reference it in your script files.

#r "nuget:Deedle.RPlugin"

In a new F# script file, first open Deedle and RProvider:

#r "nuget:RProvider"
#r "nuget:Deedle"

open RProvider
open RProvider.``base``
open RProvider.datasets
open Deedle

The Deedle R plugin should be loaded by the R type provider automatically. You can now convert back and forth between R data frames and Deedle frames by using type annotations:

let mtcars : Frame<string, string> = R.mtcars.GetValue()

// Pass Deedle data to R and print the R output
R.as_data_frame(mtcars)

// Pass Deedle data to R and get column means
R.colMeans(mtcars)
namespace RProvider
Multiple items
namespace RProvider

--------------------
type RProvider = inherit TypeProviderForNamespaces new : cfg:TypeProviderConfig -> RProvider

--------------------
new : cfg:CompilerServices.TypeProviderConfig -> RProvider
namespace RProvider.datasets
namespace Deedle
val mtcars : Frame<string,string>
Multiple items
module Frame from Deedle

--------------------
type Frame = static member ReadCsv : location:string * hasHeaders:Nullable<bool> * inferTypes:Nullable<bool> * inferRows:Nullable<int> * schema:string * separators:string * culture:string * maxRows:Nullable<int> * missingValues:string [] * preferOptions:bool -> Frame<int,string> + 1 overload static member ReadReader : reader:IDataReader -> Frame<int,string> static member CustomExpanders : Dictionary<Type,Func<obj,seq<string * Type * obj>>> static member NonExpandableInterfaces : ResizeArray<Type> static member NonExpandableTypes : HashSet<Type>

--------------------
type Frame<'TRowKey,'TColumnKey (requires equality and equality)> = interface IDynamicMetaObjectProvider interface INotifyCollectionChanged interface IFsiFormattable interface IFrame new : rowIndex:IIndex<'TRowKey> * columnIndex:IIndex<'TColumnKey> * data:IVector<IVector> * indexBuilder:IIndexBuilder * vectorBuilder:IVectorBuilder -> Frame<'TRowKey,'TColumnKey> + 1 overload member AddColumn : column:'TColumnKey * series:seq<'V> -> unit + 3 overloads member AggregateRowsBy : groupBy:seq<'TColumnKey> * aggBy:seq<'TColumnKey> * aggFunc:Func<Series<'TRowKey,'a>,'b> -> Frame<int,'TColumnKey> member Clone : unit -> Frame<'TRowKey,'TColumnKey> member ColumnApply : f:Func<Series<'TRowKey,'T>,ISeries<'TRowKey>> -> Frame<'TRowKey,'TColumnKey> + 1 overload member DropColumn : column:'TColumnKey -> unit ...

--------------------
new : names:seq<'TColumnKey> * columns:seq<ISeries<'TRowKey>> -> Frame<'TRowKey,'TColumnKey>
new : rowIndex:Indices.IIndex<'TRowKey> * columnIndex:Indices.IIndex<'TColumnKey> * data:IVector<IVector> * indexBuilder:Indices.IIndexBuilder * vectorBuilder:Vectors.IVectorBuilder -> Frame<'TRowKey,'TColumnKey>
Multiple items
val string : value:'T -> string
<summary>Converts the argument to a string using <c>ToString</c>.</summary>
<remarks>For standard integer and floating point values the and any type that implements <c>IFormattable</c><c>ToString</c> conversion uses <c>CultureInfo.InvariantCulture</c>. </remarks>
<param name="value">The input value.</param>
<returns>The converted string.</returns>


--------------------
type string = System.String
<summary>An abbreviation for the CLI type <see cref="T:System.String" />.</summary>
<category>Basic Types</category>
type R = static member AirPassengers : SymbolicExpression static member BJsales : SymbolicExpression static member BJsales_lead : SymbolicExpression static member BOD : SymbolicExpression static member CO2 : SymbolicExpression static member ChickWeight : SymbolicExpression static member DNase : SymbolicExpression static member EuStockMarkets : SymbolicExpression static member Formaldehyde : SymbolicExpression static member HairEyeColor : SymbolicExpression ...
Base R datasets.
property R.mtcars: RDotNet.SymbolicExpression with get
member RDotNet.SymbolicExpression.GetValue : unit -> 'a
type R = static member ! :?paramArray: obj [] -> SymbolicExpression + 1 overload static member != :?paramArray: obj [] -> SymbolicExpression + 1 overload static member !_hexmode :?a: obj -> SymbolicExpression + 1 overload static member !_octmode :?a: obj -> SymbolicExpression + 1 overload static member $ :?paramArray: obj [] -> SymbolicExpression + 1 overload static member $<- :?paramArray: obj [] -> SymbolicExpression + 1 overload static member $<-_data_frame :?x: obj *?name: obj *?value: obj -> SymbolicExpression + 1 overload static member $_DLLInfo :?x: obj *?name: obj -> SymbolicExpression + 1 overload static member $_package__version :?x: obj *?name: obj -> SymbolicExpression + 1 overload static member %% :?paramArray: obj [] -> SymbolicExpression + 1 overload ...
Base R functions.
Multiple items
R.as_data_frame(paramsByName: System.Collections.Generic.IDictionary<string,obj>) : RDotNet.SymbolicExpression
R.as_data_frame(?x: obj,?row_names: obj,?optional: obj,?___: obj,?paramArray: obj []) : RDotNet.SymbolicExpression
Coerce to a Data Frame

--------------------
R.as_data_frame(paramsByName: System.Collections.Generic.IDictionary<string,obj>) : RDotNet.SymbolicExpression
R.as_data_frame(?x: obj,?row_names: obj,?optional: obj,?___: obj,?paramArray: obj []) : RDotNet.SymbolicExpression
Coerce to a Data Frame
Multiple items
R.colMeans(paramsByName: System.Collections.Generic.IDictionary<string,obj>) : RDotNet.SymbolicExpression
R.colMeans(?x: obj,?na_rm: obj,?dims: obj) : RDotNet.SymbolicExpression
No documentation available

--------------------
R.colMeans(paramsByName: System.Collections.Generic.IDictionary<string,obj>) : RDotNet.SymbolicExpression
R.colMeans(?x: obj,?na_rm: obj,?dims: obj) : RDotNet.SymbolicExpression
No documentation available