You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently passing .NET NaN's to R via RDotNet (without RProvider) then convert them to NA's using a series of RDotNet engine.evaluate statements.
This isn't exactly elegant, so what I'd like to do is streamline the process by taking advantage of RProvider's syntax, e.g.
define a function
let nan2na (arr: RDotNet.SymbolicExpression) =
engine.SetSymbol("arr",arr)
engine.Evaluate("arr[is.nan(arr)] <- NA") |> ignore
engine.GetSymbol("arr")
// then we can do the following
let result = data |> R.data_matrix |> nan2na |> R.fancystuff_etc
However, when I try to do this I get a bunch of nulls back... along with
A first chance exception of type 'System.ArgumentException' occurred in RDotNet.dll
What is the best way of dealing with this?
The text was updated successfully, but these errors were encountered:
I'm a little bit unclear what you are trying to achieve here. But I think in general we don't have good handling for NA in the RProvider. Seems like NaNs are working correctly, but probably NAs are not.
If you have to resort to using evaluate (or anything on the R engine) then we have probably failed. Rather, we should have a way of representing NA on the F# side, so you can map your NaNs to NA on the F# side of things.
The natural way of doing this is probably using the Option type (so a sequence of Option would get converted into a numeric vector, where the None values are NA), or perhaps using Nullable?
This probably depends on what R.NET provides (I think it always returns N.A. as Double.NaN), but it would be good to investigate and provide some option.
I'm currently passing .NET NaN's to R via RDotNet (without RProvider) then convert them to NA's using a series of RDotNet engine.evaluate statements.
This isn't exactly elegant, so what I'd like to do is streamline the process by taking advantage of RProvider's syntax, e.g.
define a function
However, when I try to do this I get a bunch of nulls back... along with
A first chance exception of type 'System.ArgumentException' occurred in RDotNet.dll
What is the best way of dealing with this?
The text was updated successfully, but these errors were encountered: