Configuring R 2.15.1 to be used with SAP Predictive Analysis
SAP Predictive Analysis comes with the option of integrating with R Language for using the Algorithms available in PA.
R, being an Open source product, there are quick upgrades to the versions of R. But, the problem arises when we try to use a higher version of R (other than 2.15.1), which is not supported by SAP PA.
Here are few steps that you can follow to use R with SAP PA, I have gone through few references and come up with this method of installing R.
[Note : Click on the Images to get a clear view of what it is.]
Step 1: Install SAP PA [Predictive Analysis].
Follow the steps given in this link for installing SAP PA, trial version.
http://help.sap.com/businessobject/product_guides/SAPpa10/en/pa1_0_11_user_en.pdf
Step 2: Follow the link to download Windows Version of R 2.15.1 for your system.
http://cran.r-project.org/bin/windows/base/old/2.15.1/R-2.15.1-win.exe
Run the setup after you agree with the GNU Public license, which will have R installed in your system.
Step 3: Open the R GUI in your windows System.
Fig 1: Navigate your Programs to start R GUI.
You will be getting an User Interface console of R like this,
Fig 2: The R GUI Console
Once you are ready with R, we need to install certain packages in R that is required by SAP PA.
So follow the menu path to install the packages,
In R console, Click, Menu Bar,
Select Packages -> Install Packages ->
Fig 3: Menu Path to select the “Install Package” option.
Choose the CRAN Mirror closest to your location.
Fig 4: Select the CRAN Mirror
Then select the Package (rJava) from the list.
Fig 5: Select the Package (rJava).
Once you press OK, the package rJava will be installed in your system.
Step 4: Repeat Step 3 for the Package (AMORE).
These two Packages (rJava) and (AMORE) are required to use R algorithms in SAP PA.
Step 5: Set up the environment variable for R.
Simply type the following code in R Console.
(Note: The path varies as per your system, please take note of it, and change it while executing in the console).
Sys.setenv(R_LIBS = “C:/Program Files/R/R-2.15.1/library”);
Sys.setenv(R_HOME = “C:/Program Files/R/R-2.15.1/”);
Sys.setenv(Path = “existing path; C:/Program Files/R/R-2.15.1/library/rJava/jri; C:/Program Files/R/R-2.15.1/bin”);
Step 6: Open SAP PA and we need to configure PA to use R Language.
Follow the Menu path
All Programs -> SAP Business Intelligence -> SAP Predictive Analysis
In the Menu Bar, follow the path,
File -> Install and Configure R
Fig 6: Select “Install and Configure R” option in SAP Predictive Analysis
You get a Pop up, where you can find option to Install R, and to Configure R.
Since we have already manually Installed R, no need to do the first step.
Kindly navigate to the Configuration Tab, you will have to select the Check box, and Browse to the File path where R is Installed in your system.
Refer the Image for help.
Fig 7: Configure R to be used in SAP PA
Then select OK.
Now we have configured R in PA.
When you navigate to the Predict Tab in PA, you can find the R Algorithms enabled.
Fig 8: To verify if R has been Configured properly in SAP PA.
Set the parameters for the R Algorithms and play with your data.
Hi Tamil,
Quite useful...
Hi Tamilnesan,
I get error "java.lang.Throwable: Unexpected error occurred nullnull" when run some R-algorthem. If I run standard SAP PA algorithem works correct.
If you knew, please help me.
BR
Matej
Hi Matej,
In addition to the Path settings in java, as recommended by Michael, Please check out the Parameters that you Pass into the Algorithm, while building it.
These kind of errors normally occur, when there is no proper data for processing, and the system checks for a "Try, Catch and Throw" sequence.
The system throws a message, I suspect that, Since the parameters are not recognized by the Logic, we get the "nullnull" in the Parameter section of the Message.
Please try with other fields for the Algorithm and let me know.
Mean while I will look into further Solutions for this and let you know, I am also not very sure of this.
Thank you Matej !!
Regards,
Tamilnesan
Hello Matei,
did you check your JAVA_HOME Path ?
Additionally, did you check if you are
running 64bit Java with a 64bit R ?
I solved my Java-Problems checking this.
Regards,
Michael
Hi Michael and Tamilnesan,
JAVA_HOME was set correct and I use all 32 bit Java, R and SAP PA.
I install this package in R and now works R algorithem in SAP PA.
rJava
RODBC
RJDBC
DBI
monmlp
AMORE
XML
pmml
arules
caret
reshape
plyr
foreach
iterator
So is not enought to istall just rJava and AMORE.
Ragards,
Matej
Hi Matej,
Thank you so much for sharing this, Will have a note on this.
Regards,
Tamilnesan G