Working with R expressions

RProvider represents R objects and values through a SymbolicExpression type (derived from R.NET). RProvider includes a SymbolicExpression module that allows you to work with R expressions in a more idiomatic way using forward pipes (|>). First, open RProvider, its custom operators and any packages you need:

open RProvider
open RProvider.Operators

open RProvider.``base``
open RProvider.datasets
open RProvider.stats

S4 classes

For this example, let's set up an S4 class and object from scratch:

let x = R.rnorm(100)
x.Engine.Evaluate("setClass('testclass', representation(foo='character', bar='integer'))")
let s4 = x.Engine.Evaluate("new('testclass', foo='s4', bar=1:4)")

You can find out if there are slots using the slots and trySlots functions:

s4 |> SymbolicExpression.slots
s4 |> SymbolicExpression.trySlots
R.mtcars |> SymbolicExpression.trySlots

You can access slot values similarly with the slot and trySlot functions:

s4 |> SymbolicExpression.slot "foo"
s4 |> SymbolicExpression.trySlot "foo"
s4 |> SymbolicExpression.trySlot "doesntexist"
namespace RProvider
Multiple items
namespace RProvider

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

--------------------
new : cfg:CompilerServices.TypeProviderConfig -> RProvider
module Operators from RProvider
<summary> Custom operators that make composing and working with R symbolic expressions easier. </summary>
namespace RProvider.datasets
namespace RProvider.stats
val x : RDotNet.SymbolicExpression
type R = static member AIC :?object: obj *?___: obj *?k: obj *?paramArray: obj [] -> SymbolicExpression + 2 overloads static member ARMAacf :?ar: obj *?ma: obj *?lag_max: obj *?pacf: obj -> SymbolicExpression + 2 overloads static member ARMAtoMA :?ar: obj *?ma: obj *?lag_max: obj -> SymbolicExpression + 2 overloads static member BIC :?object: obj *?___: obj *?paramArray: obj [] -> SymbolicExpression + 2 overloads static member Box_test :?x: obj *?lag: obj *?type: obj *?fitdf: obj -> SymbolicExpression + 2 overloads static member C :?object: obj *?contr: obj *?how_many: obj *?___: obj *?paramArray: obj [] -> SymbolicExpression + 2 overloads static member D :?expr: obj *?name: obj -> SymbolicExpression + 2 overloads static member DF2formula :?x: obj *?env: obj -> SymbolicExpression + 2 overloads static member Gamma :?link: obj -> SymbolicExpression + 2 overloads static member HoltWinters :?x: obj *?alpha: obj *?beta: obj *?gamma: obj *?seasonal: obj *?start_periods: obj *?l_start: obj *?b_start: obj *?s_start: obj *?optim_start: obj *?optim_control: obj -> SymbolicExpression + 2 overloads ...
R statistical functions.
R.rnorm(paramsByName: List<string * obj>) : RDotNet.SymbolicExpression
R.rnorm(paramsByName: System.Collections.Generic.IDictionary<string,obj>) : RDotNet.SymbolicExpression
R.rnorm(?n: obj,?mean: obj,?sd: obj) : RDotNet.SymbolicExpression
No documentation available
property RDotNet.SymbolicExpression.Engine: RDotNet.REngine with get
RDotNet.REngine.Evaluate(stream: System.IO.Stream,?environment: RDotNet.REnvironment) : RDotNet.SymbolicExpression
RDotNet.REngine.Evaluate(statement: string,?environment: RDotNet.REnvironment) : RDotNet.SymbolicExpression
val s4 : RDotNet.SymbolicExpression
module SymbolicExpression from RProvider.RDotNetExtensions
<summary> Contains functions to make working with SymbolicExpression more idiomatic. </summary>
val slots : expr:RDotNet.SymbolicExpression -> System.Collections.Generic.IDictionary<string,string>
<summary> For an S4 object, get a dictionary containing first the slot name and second the slot's R type.</summary>
<param name="expr">An R symbolic expression</param>
<returns>A diictionary with key = slot name, and value = R type</returns>
val trySlots : expr:RDotNet.SymbolicExpression -> System.Collections.Generic.IDictionary<string,string> option
<summary> For an S4 object, get a dictionary containing first the slot name and second the slot's R type. If the expression is not an S4 object, returns `None`.</summary>
<param name="expr">An R symbolic expression</param>
<returns>A diictionary with key = slot name, and value = R type</returns>
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
val slot : name:string -> expr:RDotNet.SymbolicExpression -> RDotNet.SymbolicExpression
<summary>Gets the value of a slot as a SymbolicExpression</summary>
<param name="name">Slot name to retrieve</param>
<param name="expr">An R symbolic expression</param>
<returns>A symbolic expression containing the slot value</returns>
val trySlot : name:string -> expr:RDotNet.SymbolicExpression -> RDotNet.SymbolicExpression option
<summary>Gets the value of a slot as a SymbolicExpression</summary>
<param name="name">Slot name to retrieve</param>
<param name="expr">An R symbolic expression</param>
<returns>Some symbolic expression if the expression was an S4 object and had the slot, or None otherwise.</returns>