[graalvm-users] No NA
stepan.sindelar at oracle.com
Mon Jul 30 07:50:16 PDT 2018
> There seems to be no way to get an NA from R. Getting false back
hides the fact the data is missing.
yes. We've updated the inteop behavior in the meantime. The example you
provided gives different results in the new development version where
FastR always gives R vectors via interop and the way to get to the
elements is via sending the READ message, which is typically done with
array subscript in most languages.
So if you access "NA" with either plain "NA" or "c(NA)" in either case
you get back something that looks like an array of length 1, and if you
access the element, you get back something that looks like nil in Ruby
(responds with true to the IS_NULL message).
val = Polyglot.eval("R", "NA")
val = Polyglot.eval("R", "c(NA)")
vec = Polyglot.eval("R", "c(NA, 42)")
Note the last output is "42", not "" because by using array
subscript on an atomic vector, you get back the atomic values.
More information about the GraalVM-Users