Is there a way to represent the NA of R language in Prolog

Hi, recently I’ve been using the r_serve package in Prolog to interact with R. But now I am facing an issue. I’d like to make a list with floats and NAs in it. But I couldn’t find a way to make this work. Seems like the NA cannot be recognized during the transformation.

example(1997, 0.7).
example(1998, 'NA').
example(1999, 1.0).

the transformation code is

r_data_frame(data, [year=A, number=B], example(A, B)), 
<-data.

This gives me the error

The expected behaviour is a NA on the second line.

Thanks in advance!!

Don’t know whether this will work end-to-end, but could you use the IEEE NaN value instead of 'NA'?

?- float(1.5NaN).
true.
2 Likes

Thank you, it works now. NaN in Prolog can be transformed to NaN in R, and it works the same as NA.