0

I am able to run r script with rJava, but all the control flow in the r script file seem not running, mean it will run all the line without care about the if statement and the trycatch error. I run the same script in r or r studio and it can run perfectly.

error example:

if (1 != 0) {
    c <- 200
} else {
    c <- 100
}  

in r the result c is 200, but when run in rjava the result c return always 100 because it will run through all the line of code despite the condition flow.

Peter Hall
  • 53,120
  • 14
  • 139
  • 204
TK Thong
  • 23
  • 4
  • Since the error is with the java side, perhaps you should include your java code for others to see. Besides comments on coding style (over-writing the function `c(...)` with a variable), there is nothing about this R code which needs comment from the crowd. (Caveat: I'm not an expert in java programming nor in bring R into the java world. Last I checked though, `rJava` is about calling java from R, the other way around. Perhaps you meant [JRI](http://rforge.net/JRI/)?) – r2evans Mar 08 '17 at 07:10
  • How do you execute it? If you run it line-by line you'll get 3 errors and two evaluations. Please include exact code that you are using. – Simon Urbanek Mar 12 '17 at 03:13

0 Answers0