I'm using Rserve to call R functions using Java code. My project requires me to receive a vector and pass it to R. For example, I defined
ArrayList data = new ArrayList();
data.add("10.0");
data.add("11.0");
data.add(null);
Then I got an array list: [10.0, 11.0, null]. I tried to use c.assign("x",data); to assign the array list to variable x, but Eclipse gave me an error
The method assign(String, String) in the type RConnection is not applicable for the arguments (String, ArrayList<String>)
So instead, I used
c.assign("x",data.toString());
to calculate
1.Fill rate (Return result should be 66.67%)
nrow(matrix(x)) - sum(is.na(x)))/nrow(matrix(x))
2. Quantiles
quantile (x, c(.01, .05, .1, .25, .5, .75, .9, .95, .99))
and got
1.Fill rate = 1.0;
2.Error in calculating Quantiles because there is NULL value in the array list.
The results are obviously wrong. How do I assign an array list with NULL values to R vectors?
Basically I want R to recognize NULL or blank values passed from Java and do calculation. Really need help with this.
Many thanks!!!!!!!!!!!!!