I'm writing a Java program which uses Rserve to get results back from R.
I need to calculate frequencies of the elements in an array. For example,
array = [A, A, B, C]
I need R to return
A 2
B 1
C 1
But when I used
Rconnection c = new Rconnection();
double [] freq = c.eval(table(x)).asDoubles;
System.out.println(Arrays.toString(freq));
I got
[2 1 1]
which is not a name:value pair. How do I get that?
Many thanks!!!!!!!!