ralhei / pyRserve

A python client for Rserve (network layer to remote R server)
Other
47 stars 13 forks source link

pyRserve unable to evaluate NA_character_ #21

Closed TheJakeSchmidt closed 3 years ago

TheJakeSchmidt commented 4 years ago

This should reproduce it:

$ R CMD Rserve --no-save --RS-port 54321
R version 3.6.0 (2019-04-26) -- "Planting of a Tree"
[...]
$ python --version
Python 3.6.8
$ python -c "import pyRserve; print(pyRserve.__version__); pyRserve.connect(port=54321).eval('NA_character_')"
0.9.1
[...]
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
ralhei commented 4 years ago

The question is: What should this be translated to in Python? If I understand it right the NA stands for 'not available', but I don't know of anything similar in Python. Any suggestions?

TheJakeSchmidt commented 4 years ago

NA_character_ is like NA (which has type logical), but with type character. pyRserve returns True for conn.eval('NA'), but maybe it should return None? I think None is probably the closest Python equivalent for both NA and NA_character_, since Python doesn't have the distinction R has between NA and NULL, and I'm not sure that distinction is significant in a standalone context anyway.