I'm currently using JRI, the Java package in order to use some of the functions provided by R.
Let's say, my R command goes like this:
qqnorm(sql_data[["LifeExpectancy"]],
main="Life Expectancy")
If I put this into my REngine.eval() function, it crashes, because I'm supposed to enter the whole command into one "eval()" command. It works in my normal R command line though...
The major problem is, that it's hard to predict for me, whenever the next order is split up into multiple lines or not. So, how may I fix that problem?
I thought about counting the brackets, but the number of brackets isn't always even. (Let's say, some brackets are contained in Strings) Any other ideas?
Edit: I think, my point is not obvious enough. Try this out:
System.out.println(re.eval("a <- c(3,4)"));
System.out.println(re.eval("a"));
System.out.println(re.eval("b <- c(3,4"));
System.out.println(re.eval(",5)"));
System.out.println(re.eval("b"));
You'll see, that for the first two commands, a, you receive
[REAL* (3.0, 4.0)]
[REAL* (3.0, 4.0)]
But the rest, b, goes like this:
[NULL ]
[NULL ]
null
It's a problem with R in general; usually this works, but not in JRI!