One of the great new features of OBIEE 12c is the ability to have advanced analytic functions based on R. "R is a widely used environment for statistical computing and graphics
and can be used with many different datasources including external files
or databases."
This post will only deal with enabling this functionality on the server. But first what we get?
The default functions are Cluster, Outlier, Regr, Trendline and Evaluate Script:
For example Regression:
User can add additional R Based functions based on your own scripts through Evaluate Script .
When trying to run Analytics function by default, without the setup, for example: REGR("Base Facts"."Revenue", ("Base Facts"."Discount Amount"), ("Products"."Product Type", "Products"."Brand"), 'fitted', '') I get an error.
The critical part of it is: State: HY000. Code: 47092. [nQSError: 47092] The value of R_EXECUTABLE_PATH is set to /usr/bin/R which is invalid. (HY000).
To solve it, I have to setup R in the environment.
In this post I will do the basic "regular" R setup on Windows box. The Unix / Linux steps are in the guide as well as the Oracle R Enterprise.
The R package is in ORACLE_HOME/bi/bifoundation/advanced_analytics/r-installer.tar.gz (on my computer it is D:\MWHOME12\bi\bifoundation\advanced_analytics).
Oracle recommends to download and install unzip and wget utilities:
I unzipped the r-installer.tar.gz in the same folder on the disk, got r-installer.tar file and unzipped it as well. Now I have a RInstaller folder at the same location ORACLE_HOME/bi/bifoundation/advanced_analytics/.
R uses internet connection to download software and packages. That is why before installing Oracle recommends to set up the definitions in
proxy.txt. For example, if you are working from within
Oracle intranet you should setup proxy=http://www-proxy.us.oracle.com:80 in that file.What should you do when you are in "regular" / not secured network? This part took me some time. Eventually, I opened a command windows and executed ipconfig (ifconfig in linux). I used the default Gateway ip. Assuming my default Gateway 192.1.1.1, in my proxy.txt I used
proxy=192.168.4.1:80 .(Another, not recommended and probably not supported option, would be to delete the first 2 lines in r-package-install.R)
Now comes the actual installation.
I opened a command line in Oracle_Home/bi/bifoundation/advanced_analytics/RInstaller and run set path=%path%;C:\Program Files (x86)\GnuWin32\bin (to add wget to the path).
Now RInstaller.bat install
Next to install the R specific packages I'd run RInstaller.bat installpackages
It installs required R packages (forecast, mvoutlier, randomForest, RJSONIO, and
matrixcalc). Running this command also installs the
OBIEEAdvancedAnalytics R package that is in the Oracle_Home/bi/bifoundation/advanced_analytics/RInstaller/OBIEERPackage.
If your failed with text such as bellow, that means you have a problem with your proxy.txt.
You are using Oracle's distribution of R. Please contact Oracle Support for any problems you encounter with this distribution.
> proxy<-read.table("proxy.txt", header=FALSE, sep="=", stringsAsFactors=FALSE)[
,2]
> Sys.setenv(http_proxy=proxy)
> install.packages("forecast", repos="http://cran.us.r-project.org")
...
Warning: unable to access index for repository http://cran.us.r-project.org/bin/
windows/contrib/3.1
Warning message:
package 'forecast' is not available (for Oracle Distribution of R version 3.1.1)
My R installation is now in C:\Program Files\R\R-3.1.1
Lets find NQSConfig.ini in BI_DOMAIN/config/fmwconfig/biconfig/OBIS = ORacle_home/user_projects/domains/bi/config/fmwconfig/biconfig/OBIS. Find there ADVANCE_ANALYTICS_SCRIPT section and update R_EXECUTABLE_PATH to point to the R exactable path: C:/Program Files/R/R-3.1.1/bin/x64/R
Restarted OBIS.
Now it’s working.
If you want to try an offline environment, here is the response of the R installpackages:
There is a binary version available (and will be installed) but the
source version is later:
binary source
forecast 7.1 7.2
also installing the dependencies 'stringi', 'magrittr', 'stringr', 'RColorBrewer', 'dichromat', 'munsell', 'labeling', 'quadprog', 'digest', 'gtable', 'plyr', 'reshape2', 'scales', 'zoo', 'timeDate', 'tseries', 'fracdiff', 'Rcpp', 'colorspace', 'ggplot2', 'RcppArmadillo'
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/stringi_1.0-1.zip'
Content type 'application/zip' length 14266706 bytes (13.6 Mb)
opened URL
downloaded 13.6 Mb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/magrittr_1.5.zip'
Content type 'application/zip' length 152098 bytes (148 Kb)
opened URL
downloaded 148 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/stringr_1.0.0.zip'
Content type 'application/zip' length 83256 bytes (81 Kb)
opened URL
downloaded 81 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/RColorBrewer_1.1-2.zip'
Content type 'application/zip' length 26693 bytes (26 Kb)
opened URL
downloaded 26 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/dichromat_2.0-0.zip'
Content type 'application/zip' length 147716 bytes (144 Kb)
opened URL
downloaded 144 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/munsell_0.4.3.zip'
Content type 'application/zip' length 133217 bytes (130 Kb)
opened URL
downloaded 130 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/labeling_0.3.zip'
Content type 'application/zip' length 40838 bytes (39 Kb)
opened URL
downloaded 39 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/quadprog_1.5-5.zip'
Content type 'application/zip' length 51790 bytes (50 Kb)
opened URL
downloaded 50 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/digest_0.6.9.zip'
Content type 'application/zip' length 171597 bytes (167 Kb)
opened URL
downloaded 167 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/gtable_0.2.0.zip'
Content type 'application/zip' length 56874 bytes (55 Kb)
opened URL
downloaded 55 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/plyr_1.8.3.zip'
Content type 'application/zip' length 1115538 bytes (1.1 Mb)
opened URL
downloaded 1.1 Mb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/reshape2_1.4.1.zip'
Content type 'application/zip' length 503787 bytes (491 Kb)
opened URL
downloaded 491 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/scales_0.4.0.zip'
Content type 'application/zip' length 601939 bytes (587 Kb)
opened URL
downloaded 587 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/zoo_1.7-13.zip'
Content type 'application/zip' length 900274 bytes (879 Kb)
opened URL
downloaded 879 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/timeDate_3012.100.zip'
Content type 'application/zip' length 807624 bytes (788 Kb)
opened URL
downloaded 788 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/tseries_0.10-34.zip'
Content type 'application/zip' length 320841 bytes (313 Kb)
opened URL
downloaded 313 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/fracdiff_1.4-2.zip'
Content type 'application/zip' length 106800 bytes (104 Kb)
opened URL
downloaded 104 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/Rcpp_0.12.4.zip'
Content type 'application/zip' length 3236565 bytes (3.1 Mb)
opened URL
downloaded 3.1 Mb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/colorspace_1.2-6.zip'
Content type 'application/zip' length 389026 bytes (379 Kb)
opened URL
downloaded 379 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/ggplot2_2.1.0.zip'
Content type 'application/zip' length 1989346 bytes (1.9 Mb)
opened URL
downloaded 1.9 Mb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/RcppArmadillo_0.6.700.3.0.zip'
Content type 'application/zip' length 1697255 bytes (1.6 Mb)
opened URL
downloaded 1.6 Mb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/forecast_7.1.zip'
Content type 'application/zip' length 1364370 bytes (1.3 Mb)
opened URL
downloaded 1.3 Mb
package 'stringi' successfully unpacked and MD5 sums checked
package 'magrittr' successfully unpacked and MD5 sums checked
package 'stringr' successfully unpacked and MD5 sums checked
package 'RColorBrewer' successfully unpacked and MD5 sums checked
package 'dichromat' successfully unpacked and MD5 sums checked
package 'munsell' successfully unpacked and MD5 sums checked
package 'labeling' successfully unpacked and MD5 sums checked
package 'quadprog' successfully unpacked and MD5 sums checked
package 'digest' successfully unpacked and MD5 sums checked
package 'gtable' successfully unpacked and MD5 sums checked
package 'plyr' successfully unpacked and MD5 sums checked
package 'reshape2' successfully unpacked and MD5 sums checked
package 'scales' successfully unpacked and MD5 sums checked
package 'zoo' successfully unpacked and MD5 sums checked
package 'timeDate' successfully unpacked and MD5 sums checked
package 'tseries' successfully unpacked and MD5 sums checked
package 'fracdiff' successfully unpacked and MD5 sums checked
package 'Rcpp' successfully unpacked and MD5 sums checked
package 'colorspace' successfully unpacked and MD5 sums checked
package 'ggplot2' successfully unpacked and MD5 sums checked
package 'RcppArmadillo' successfully unpacked and MD5 sums checked
package 'forecast' successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\BDAHAB\AppData\Local\Temp\RtmpWkBg3J\downloaded_packages
also installing the dependencies 'minqa', 'nloptr', 'RcppEigen', 'Matrix', 'lme4', 'SparseM', 'MatrixModels', 'pbkrtest', 'quantreg', 'lmtest', 'chron', 'mvtnorm', 'pcaPP', 'reshape', 'car', 'sp', 'vcd', 'data.table', 'pls', 'e1071', 'cvTools', 'rrcov', 'GGally', 'sROC', 'VIM', 'DEoptimR', 'sgeostat', 'robCompositions', 'robustbase'
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/minqa_1.2.4.zip'
Content type 'application/zip' length 557056 bytes (544 Kb)
opened URL
downloaded 544 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/nloptr_1.0.4.zip'
Content type 'application/zip' length 1103488 bytes (1.1 Mb)
opened URL
downloaded 1.1 Mb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/RcppEigen_0.3.2.8.1.zip'
Content type 'application/zip' length 2146647 bytes (2.0 Mb)
opened URL
downloaded 2.0 Mb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/Matrix_1.2-6.zip'
Content type 'application/zip' length 3658581 bytes (3.5 Mb)
opened URL
downloaded 3.5 Mb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/lme4_1.1-10.zip'
Content type 'application/zip' length 4783214 bytes (4.6 Mb)
opened URL
downloaded 4.6 Mb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/SparseM_1.7.zip'
Content type 'application/zip' length 803181 bytes (784 Kb)
opened URL
downloaded 784 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/MatrixModels_0.4-1.zip'
Content type 'application/zip' length 273716 bytes (267 Kb)
opened URL
downloaded 267 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/pbkrtest_0.4-4.zip'
Content type 'application/zip' length 211304 bytes (206 Kb)
opened URL
downloaded 206 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/quantreg_5.21.zip'
Content type 'application/zip' length 2143984 bytes (2.0 Mb)
opened URL
downloaded 2.0 Mb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/lmtest_0.9-34.zip'
Content type 'application/zip' length 283374 bytes (276 Kb)
opened URL
downloaded 276 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/chron_2.3-47.zip'
Content type 'application/zip' length 108750 bytes (106 Kb)
opened URL
downloaded 106 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/mvtnorm_1.0-5.zip'
Content type 'application/zip' length 227908 bytes (222 Kb)
opened URL
downloaded 222 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/pcaPP_1.9-60.zip'
Content type 'application/zip' length 431315 bytes (421 Kb)
opened URL
downloaded 421 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/reshape_0.8.5.zip'
Content type 'application/zip' length 127692 bytes (124 Kb)
opened URL
downloaded 124 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/car_2.0-25.zip'
Content type 'application/zip' length 1386767 bytes (1.3 Mb)
opened URL
downloaded 1.3 Mb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/sp_1.2-3.zip'
Content type 'application/zip' length 1572259 bytes (1.5 Mb)
opened URL
downloaded 1.5 Mb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/vcd_1.4-1.zip'
Content type 'application/zip' length 1168271 bytes (1.1 Mb)
opened URL
downloaded 1.1 Mb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/data.table_1.9.6.zip'
Content type 'application/zip' length 1886842 bytes (1.8 Mb)
opened URL
downloaded 1.8 Mb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/pls_2.5-0.zip'
Content type 'application/zip' length 1097082 bytes (1.0 Mb)
opened URL
downloaded 1.0 Mb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/e1071_1.6-7.zip'
Content type 'application/zip' length 814561 bytes (795 Kb)
opened URL
downloaded 795 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/cvTools_0.3.2.zip'
Content type 'application/zip' length 151691 bytes (148 Kb)
opened URL
downloaded 148 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/rrcov_1.3-11.zip'
Content type 'application/zip' length 1313405 bytes (1.3 Mb)
opened URL
downloaded 1.3 Mb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/GGally_1.0.1.zip'
Content type 'application/zip' length 4497457 bytes (4.3 Mb)
opened URL
downloaded 4.3 Mb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/sROC_0.1-2.zip'
Content type 'application/zip' length 81913 bytes (79 Kb)
opened URL
downloaded 79 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/VIM_4.4.1.zip'
Content type 'application/zip' length 970462 bytes (947 Kb)
opened URL
downloaded 947 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/DEoptimR_1.0-4.zip'
Content type 'application/zip' length 34498 bytes (33 Kb)
opened URL
downloaded 33 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/sgeostat_1.0-27.zip'
Content type 'application/zip' length 99260 bytes (96 Kb)
opened URL
downloaded 96 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/robCompositions_2.0.0.zip'
Content type 'application/zip' length 1241812 bytes (1.2 Mb)
opened URL
downloaded 1.2 Mb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/robustbase_0.92-5.zip'
Content type 'application/zip' length 2980581 bytes (2.8 Mb)
opened URL
downloaded 2.8 Mb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/mvoutlier_2.0.6.zip'
Content type 'application/zip' length 730737 bytes (713 Kb)
opened URL
downloaded 713 Kb
package 'minqa' successfully unpacked and MD5 sums checked
package 'nloptr' successfully unpacked and MD5 sums checked
package 'RcppEigen' successfully unpacked and MD5 sums checked
package 'Matrix' successfully unpacked and MD5 sums checked
package 'lme4' successfully unpacked and MD5 sums checked
package 'SparseM' successfully unpacked and MD5 sums checked
package 'MatrixModels' successfully unpacked and MD5 sums checked
package 'pbkrtest' successfully unpacked and MD5 sums checked
package 'quantreg' successfully unpacked and MD5 sums checked
package 'lmtest' successfully unpacked and MD5 sums checked
package 'chron' successfully unpacked and MD5 sums checked
package 'mvtnorm' successfully unpacked and MD5 sums checked
package 'pcaPP' successfully unpacked and MD5 sums checked
package 'reshape' successfully unpacked and MD5 sums checked
package 'car' successfully unpacked and MD5 sums checked
package 'sp' successfully unpacked and MD5 sums checked
package 'vcd' successfully unpacked and MD5 sums checked
package 'data.table' successfully unpacked and MD5 sums checked
package 'pls' successfully unpacked and MD5 sums checked
package 'e1071' successfully unpacked and MD5 sums checked
package 'cvTools' successfully unpacked and MD5 sums checked
package 'rrcov' successfully unpacked and MD5 sums checked
package 'GGally' successfully unpacked and MD5 sums checked
package 'sROC' successfully unpacked and MD5 sums checked
package 'VIM' successfully unpacked and MD5 sums checked
package 'DEoptimR' successfully unpacked and MD5 sums checked
package 'sgeostat' successfully unpacked and MD5 sums checked
package 'robCompositions' successfully unpacked and MD5 sums checked
package 'robustbase' successfully unpacked and MD5 sums checked
package 'mvoutlier' successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\BDAHAB\AppData\Local\Temp\RtmpWkBg3J\downloaded_packages
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/RJSONIO_1.3-0.zip'
Content type 'application/zip' length 1236086 bytes (1.2 Mb)
opened URL
downloaded 1.2 Mb
package 'RJSONIO' successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\BDAHAB\AppData\Local\Temp\RtmpWkBg3J\downloaded_packages
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/matrixcalc_1.0-3.zip'
Content type 'application/zip' length 163518 bytes (159 Kb)
opened URL
downloaded 159 Kb
package 'matrixcalc' successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\BDAHAB\AppData\Local\Temp\RtmpWkBg3J\downloaded_packages
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/randomForest_4.6-12.zip'
Content type 'application/zip' length 177216 bytes (173 Kb)
opened URL
downloaded 173 Kb
package 'randomForest' successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\BDAHAB\AppData\Local\Temp\RtmpWkBg3J\downloaded_packages
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/NbClust_3.0.zip'
Content type 'application/zip' length 39943 bytes (39 Kb)
opened URL
downloaded 39 Kb
package 'NbClust' successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\BDAHAB\AppData\Local\Temp\RtmpWkBg3J\downloaded_packages
also installing the dependencies 'bitops', 'gtools', 'gdata', 'caTools', 'gplots'
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/bitops_1.0-6.zip'
Content type 'application/zip' length 36018 bytes (35 Kb)
opened URL
downloaded 35 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/gtools_3.4.2.zip'
Content type 'application/zip' length 128615 bytes (125 Kb)
opened URL
downloaded 125 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/gdata_2.17.0.zip'
Content type 'application/zip' length 1177911 bytes (1.1 Mb)
opened URL
downloaded 1.1 Mb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/caTools_1.17.1.zip'
Content type 'application/zip' length 229550 bytes (224 Kb)
opened URL
downloaded 224 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/gplots_3.0.1.zip'
Content type 'application/zip' length 511603 bytes (499 Kb)
opened URL
downloaded 499 Kb
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.1/ROCR_1.0-7.zip'
Content type 'application/zip' length 151965 bytes (148 Kb)
opened URL
downloaded 148 Kb
package 'bitops' successfully unpacked and MD5 sums checked
package 'gtools' successfully unpacked and MD5 sums checked
package 'gdata' successfully unpacked and MD5 sums checked
package 'caTools' successfully unpacked and MD5 sums checked
package 'gplots' successfully unpacked and MD5 sums checked
package 'ROCR' successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\BDAHAB\AppData\Local\Temp\RtmpWkBg3J\downloaded_packages
* installing *source* package 'OBIEEAdvancedAnalytics' ...
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (OBIEEAdvancedAnalytics)
Oracle Distribution of R version 3.1.1 (2012-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=Hebrew_Israel.1255 LC_CTYPE=Hebrew_Israel.1255
[3] LC_MONETARY=Hebrew_Israel.1255 LC_NUMERIC=C
[5] LC_TIME=Hebrew_Israel.1255
attached base packages:
[1] stats graphics grDevices utils datasets base
loaded via a namespace (and not attached):
[1] tools_3.1.1
#### R Package Install completed successfully ####