I want to get results from an method which is called kruskalmc.
The results in R console look like that:
Multiple comparison test after Kruskal-Wallis
p.value: 0.05
Comparisons
obs.dif critical.dif difference
1-2 7.65 9.425108 FALSE
1-3 14.40 9.425108 TRUE
2-3 6.75 9.425108 FALSE
Now i want to get the values from the difference column.
If i try to get it in java with:
REXP res = re.eval("result$dif.com$difference");
I'll get back something like this: [BOOLi* ]
How can i iterate through in BOOLi object in java?
What i want are the values FALSE TRUE FALSE.
I haven't used JRI much but since no-one has answered you I'll go for it.
I could be wrong, but it seems there is no method for converting res
to a boolean array – although there are methods for converting to int[]
, double[]
and String[]
. You could convert your result to integers like this:
REXP res = re.eval("result$dif.com$difference");
int[] x = res.asIntArray();
for (int i = 0; i < x.length; i++) {
System.out.println(x[i]);
}
You will get back 1
representing TRUE
values and 0
representing FALSE
. You can convert those numbers to booleans if you want from Java then or just work with them as they are.
Not an ideal solution so I hope someone comes up with something better.