R Code
abc <- function(theta,y) {
a <- y[1]
b <- y[2]
c <- y[3]
p <- c/(1+(a*(theta-b)))
return(p)
}
Java Code
RConnection connection = new RConnection();
connection.eval("source('D:\\\\file.R')");
double theta = 7
double a = 5
double b = 9
double c = 2
double y = "c(a,b,c)" // 'y' is R vector of length 3 (one-dimensional array)
with a, b, and c parameters as elements
double sum = connection.eval("abc("+theta+","+y+")")
log.info("The sum is=" + sum);
Problem
I want to pass vector (y) on eval function but not able to do that. Is there any way to do that ??