-->

unable to install packages(“caret”) completely in

2020-08-25 05:34发布

问题:

> require("caret")
  Loading required package: caret
  Loading required package: lattice
  Loading required package: ggplot2
  Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck =      vI[[j]]) : 
   there is no package called ‘pbkrtest’

So I found that there is lack of "pbkrtest" then I tried to reinstall it.

> install.packages("pbkrtest")
 Installing package into ‘C:/Users/ADMIN/Documents/R/win-library/3.2’
 (as ‘lib’ is unspecified)

 There is a binary version available but the source version is
 later:
     binary source needs_compilation
 pbkrtest  0.4-2  0.4-3             FALSE

 installing the source package ‘pbkrtest’

trying URL 'https://rweb.crmda.ku.edu/cran/src/contrib/pbkrtest_0.4-  3.tar.gz'
Content type 'application/x-gzip' length 164415 bytes (160 KB)
downloaded 160 KB

* installing *source* package 'pbkrtest' ...
** package 'pbkrtest' successfully unpacked and MD5 sums checked
** R
** data
** inst
** preparing package for lazy loading
Warning: replacing previous import by 'stats::sigma' when loading 'pbkrtest'
Error : object 'sigma' is not exported by 'namespace:stats'
ERROR: lazy loading failed for package 'pbkrtest'
* removing 'C:/Users/ADMIN/Documents/R/win-library/3.2/pbkrtest'

The downloaded source packages are in 
    ‘C:\Users\ADMIN\AppData\Local\Temp\Rtmpk7mJT0\downloaded_packages’
Warning messages:
1: running command '"D:/R-3.2.3/bin/x64/R" CMD INSTALL -l     
"C:\Users\ADMIN\Documents\R\win-library\3.2"   

  C:\Users\ADMIN\AppData\Local\Temp\Rtmpk7mJT0/downloaded_packages/pbkrtest_0.4-  3.tar.gz' had status 1 
2: In install.packages("pbkrtest") :
installation of package ‘pbkrtest’ had non-zero exit status

It seems like that the installation keeps failing. As a result, I couldn't use other code using caret packages.

回答1:

I faced this problem as well on Windows 7. I did following steps in the sequence and it worked. a) Make sure your R version is updated latest R release 3.2.3 b) The default sources seems to be installing Unix version. So I manually downloaded https://cran.r-project.org/web/packages/pbkrtest/index.html for windows c) Use manually install function from R menu to install the package.

Cheers, Ratan



回答2:

  1. Check version of R by typing version in your console. If version is not "version.string R version 3.3.2" or later then
  2. Install new version of R from https://cran.r-project.org/bin/windows/base/
  3. Update R version using Tools => Global Options in RStudio.
  4. install package using "install.packages("caret")" in your console.
  5. do require(caret).
  6. test using ?createDataPartition.


标签: r package