In step 1, we set up the environment variables R_HOME to where R has been installed and add the R bin directory to the environment variable PATH. If these environment variables are not set, you will see the following error message:
"R_HOME is not set. Please set all required environment variables before running this program. Unable to start R."
In step 2, we run the SimpleJRIStat Java program. Open the SimpleJRIStat.java code:
- In the main method, we first create an instance of Rengine to begin an R session.
- We check to make sure that the R session is active with the waitForR method.
- We create an array of doubles in Java and assign it to a variable called values. The values variable exists in the R environment and not in ...