The Java code below reads the included R "iris" dataset, yet, although the Chi-Sq and df match, the p-value is different using Java.
In R, I'm reading the Iris table the same was as in Java, like this:
mydata <- read.table('iris.csv', sep=',', header=TRUE, stringsAsFactor=FALSE)
Running this dataset in R, the p-value is 2.2e-16, yet using the same dataset from the Java side gives me a p-value of 3.352034178317223E-20.
No idea why the p-values aren't the same given that the two other statistics are the same.
Would appreciate suggestions what might be wrong with the Java code approach below.
Thanks.
rConnection.eval("library('biotools')");
String tableRead = "read.table('iris.csv', sep=',', header=TRUE, stringsAsFactor=FALSE)";
REXP boxMResult = rConnection.eval("boxM("+ tableRead+ "[,-5]," + tableRead + "[, 5])");