I have a scala program that produces some time series data to be used in R. The data values are Doubles with some missing values but I don't know how I should represent these NA values in my scala program?
Use org.rosuda.REngine.REXPDouble.NA
to indicate to R that there is missing data. It is a type of Double.NaN
, but different than the one that Java normally uses (so you have to specify it). You can use org.rosuda.REngine.REXPDouble.isNA
to verify whether a NaN
is R's missing-data NaN or an ordinary one.
For what it's worth, the value presently seems to be 0x7ff00000000007a2L
, which you can put into a double yourself like so: java.lang.Double.longBitsToDouble(0x7ff00000000007a2L)
. Probably safer to just use REXPDouble.NA
, though.