Skip to Content

Hi,

Several users of SAP Predictive Analytics encountered some issues running the R nodes in Expert Analytics after installing R for the first time using the download link provided in the user interface.

The provided download link of R is the 3.2.1 version where the R development community committed some changes in the list of packages and dependencies causing some issues when trying to use some of the most common packages like the Carret package which miss pbkrtest.

For example, when you try to use the R-CNR-Tree algorithm, you may get the following message:

     Error from R: Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :

       there is no package called ‘pbkrtest’

Here the link describing the package https://cran.r-project.org/web/packages/pbkrtest/index.html

After digging a little, it seems that other packages have changed in the 3.2.1 version like Carret.

So let’s fix this one!

First let’s check why we have some troubles:

  • Open R Studio (by running th shortcut on the desktop or or the start menu or “C:\Users\Public\R-3.2.1\bin\x64\Rgui.exe”)
  • Type in

require (“car”)

  • You will get the following message

Loading required package: car

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :

  there is no package called ‘pbkrtest’

In addition: Warning message:package ‘car’ was built under R version 3.2.3

  • Type in

install.packages(“pbkrtest”)

  • You will get a prompt to select a CRAN mirror

— Please select a CRAN mirror for use in this session —

  • But this is will result in the following message:

Warning message:

package ‘pbkrtest’ is not available (for R version 3.2.1)

So we need to manually install the package:

“C:/Users/Public/R-3.2.1/bin/x64/R” CMD INSTALL -l “C:\Users\Public\R-3.2.1\library” “C:\temp\pbkrtest_0.4-4.tar.gz”

This is the logs you should get:

* installing *source* package ‘pbkrtest’ …

** package ‘pbkrtest’ successfully unpacked and MD5 sums checked

** R

** data

** inst

** preparing package for lazy loading

Warning: package ‘lme4’ was built under R version 3.2.3

** help

*** installing help indices

** building package indices

** installing vignettes

** testing if installed package can be loaded

Warning: package ‘lme4’ was built under R version 3.2.3

* DONE (pbkrtest)

Now if you go back to R Studio and type in:

require (“car”)

It should all be ok and you can start using SAP Predictive Analytics.

However, if you get the following message while installing pbkrtest:

Warning: package ‘lme4’ was built under R version 3.2.3

Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :  namespace ‘nlme’ 3.1-120 is being loaded, but >= 3.1.123 is required

Error : package ‘lme4’ could not be loaded

ERROR: lazy loading failed for package ‘pbkrtest’

* removing ‘C:/Users/Public/R-3.2.1/library/pbkrtest’

Then run the following command from the R studio:

     install.packages(“lme4”)

This should give you the following output:

     trying URL ‘http://cran.irsn.fr/bin/windows/contrib/3.2/lme4_1.1-11.zip

     Content type ‘application/zip’ length 4746682 bytes (4.5 MB)

     downloaded 4.5 MB

     package ‘lme4’ successfully unpacked and MD5 sums checked

     The downloaded binary packages are in

             C:\Users\i304811\AppData\Local\Temp\Rtmp2xL4SS\downloaded_packages

Then run the following from a DOS prompt:

    “C:/Users/Public/R-3.2.1/bin/x64/R” CMD INSTALL -l “C:\Users\Public\R-3.2.1\library” “C:\Users\i304811\AppData\Local\Temp\Rtmp2xL4SS\downloaded_packages\lme4_1.1-11.zip”

And run again run the following command line from a DOS prompt:

“C:/Users/Public/R-3.2.1/bin/x64/R” CMD INSTALL -l “C:\Users\Public\R-3.2.1\library” “C:\temp\pbkrtest_0.4-4.tar.gz”

Hope this helps!

@bdel

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply