r - Passing a seq<float option> from F# to RProvider -


i want able pass sequence of option float rprovider in f#. if have sequence of floats some float , none, how can none values r rprovider? have expected nones equivalent na value in r, can't pass seq<option float> r.

for example, with

open system open rdotnet open rprovider open rprovider.graphics open rprovider.stats    let optdata4 =      seq [some 10.0; 9.0; 8.0; none; 6.0;          5.0; 5.0; none; 4.0; 2.0;          none]  let testdata4 =      namedparams [         "regprice", optdata4;]     |> r.data_frame 

i multi-line error:

system.exception: no converter registered type microsoft.fsharp.collections.fsharplist`1[[microsoft.fsharp.core.fsharpoption`1[[system.double, mscorlib, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089]], fsharp.core, version=4.4.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a]] or of base types >    @ rprovider.rinteropinternal.converttor@164.invoke(string message) in c:\tomas\public\bmc\fsharp.rprovider\src\rprovider\rinterop.fs:line 164    @ rprovider.rinteropinternal.rengine.setvalue(rengine this, object value, fsharpoption`1 symbolname) in c:\tomas\public\bmc\fsharp.rprovider\src\rprovider\rinterop.fs:line 274    @ rprovider.rinteropinternal.tor(object value) in c:\tomas\public\bmc\fsharp.rprovider\src\rprovider\rinterop.fs:line 287    @ rprovider.rinterop.passarg@447(list`1 tempsymbols, object arg) in c:\tomas\public\bmc\fsharp.rprovider\src\rprovider\rinterop.fs:line 461    @ rprovider.rinterop.arglist@468-1.generatenext(ienumerable`1& next) in c:\tomas\public\bmc\fsharp.rprovider\src\rprovider\rinterop.fs:line 469    @ microsoft.fsharp.core.compilerservices.generatedsequencebase`1.movenextimpl()    @ microsoft.fsharp.core.compilerservices.generatedsequencebase`1.system-collections-ienumerator-movenext()    @ system.collections.generic.list`1..ctor(ienumerable`1 collection)    @ microsoft.fsharp.collections.seqmodule.toarray[t](ienumerable`1 source)    @ rprovider.rinterop.callfunc(string packagename, string funcname, ienumerable`1 argsbyname, object[] varargs) in c:\tomas\public\bmc\fsharp.rprovider\src\rprovider\rinterop.fs:line 466    @ <startupcode$fsi_0012>.$fsi_0012.main@() in c:\users\sranney\repositories\carolina_refit_bits\refit_bits\refit_bits\rdemo.fs:line 102 stopped due error 

the way can pass rprovider if convert seq<option float> seq<float>

let optdata4 =      seq [some 10.0; 9.0; 8.0; none; 6.0;          5.0; 5.0; none; 4.0; 2.0;          none]     |> seq.choose id  let testdata4 =      namedparams [         "regprice", optdata4;]     |> r.data_frame 

but negates purpose of having option of none (which, have thought comparable rs na value.

how can pass sequence of values rprovider of values none in f# , should na in r?

i think should able replacing none values nan (this not entirely right, because in r na , nan different, there no way express 2 different non-values float in f#):

let optdata4 =      [ 10.0; 9.0; 8.0; nan; 6.0; 5.0; 5.0; nan; 4.0; 2.0; nan ]  let testdata4 =      namedparams [         "regprice", optdata4;]     |> r.data_frame 

i have not tested this, think in deedle internally.


Comments