I am trying to integrate R code inside java code.Primary objective is to be able to use predictions on models created in R. I am able to set up the environment properly and basic R commands are working fine. Issue: trying to push data from java to R function.
code snippet:
REXP data=re.eval("newdata <- with(cbpp, expand.grid(period=unique(period), herd=unique(herd)))");
REXP fit=re.eval("predict(gm1,newdata,type=\"response\")"); //Want to pass data created in java as newdata
System.out.println(fit.asDoubleArray().length);
in above code the "newdata is being populated by R and used what i want is to be able to create my own data in java and pass to predict function in R. Note: The R code i am trying to execute is an example for lme4 package for generalised linear mixed mmodel(glmm) model