It seems that it RTypeProvidercan only process namedParamsthe same type. This is true?
For instance,
open RDotNet
open RProvider
type foo = {
Which: string
Qty: float option
}
let someFoos = [{Which = "that"; Qty = Some 4.0}; {Which = "other"; Qty = Some 2.0}]
let thingForR =
namedParams [
"which", someFoos |> List.map (fun x -> x.Which);
"qty", someFoos |> List.map (fun x -> x.Qty);
]
|> R.data_frame
not working since I get an error x.Qty
This expression was expected to have type
string
but here has type
float option
If I thingForRreverse the order in let, then I get the opposite error:
let thingForR =
namedParams [
"qty", someFoos |> List.map (fun x -> x.Qty);
"which", someFoos |> List.map (fun x -> x.Which);
]
|> R.data_frame
Here the error x.Whichis not equal to
This expression was expected to have type
float option
but here has type
string
Can a dictionary in namedParamsnot have different types? If so, how can you create a data frame with different types in F # and pass them to R?
source
share