psoundararajan / rcaller

Automatically exported from code.google.com/p/rcaller
Other
0 stars 0 forks source link

NA values in numeric arrays, special XML symbols, nested lists #23

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
There are several problems in current version of RCaller which doesn't allow me 
to use it in my project:

 * RCaller doesn't support NA values in numeric arrays. For every method which returns numeric array (getAsIntArray, getAsLongArray, getAsFloatArray, getAsDoubleArray) I added overloaded method which have one more param - default value, this value is set to corresponding element in java array when element in R array is NA. Version without default in case of some element is NA throws ParserException (for backward compatibility). Also I added getAsIntArrayWithNull, getAsLongArrayWithNull, getAsFloatArrayWithNull, getAsDoubleArrayWithNull which return Integer[], Long[], Float[], Double[] and return null for NA elements. This is done efficiently so I don't convert primitive to wrapper when it's not necessary.

 * RCaller doesn't escape xml characters, so it's impossible to send for example "a < b" string from R to Java.

 * RCaller doesn't support nested lists that I have in my app. So for example I need to export the following list from R to java "res <- list(a = list(x = c(1, 2), y = 3), b = c('a', 'b', 'c'))". I added ability to do this in dot notation, so for this example in result xml I have 3 arrays: "a.x", "a.y" and "b" which I can use from java.

I implemented these features by myself and attached patch here, please consider 
the possibility of including these features to base repository.

Thank you. 

Original issue reported on code.google.com by ymak...@gmail.com on 8 Sep 2014 at 9:27

Attachments: