R版本3.2.3中无法完全安装“caret”包

9
> 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’

我发现缺少“pbkrtest”,所以尝试重新安装它。

> 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

看起来安装一直失败。 因此,我无法使用其他使用caret包的代码。


3
我刚从https://cran.r-project.org/web/packages/pbkrtest/index.html下载了r_release版本。然后手动安装它,问题好像就解决了... - Samuel Lee
4
在Rhelp论坛上有一篇帖子详细解释了这个问题:搜索主题为“更新包失败:需要修复的帮助”。 - IRTFM
2个回答

2
我在Windows 7上也遇到了这个问题。我按照以下步骤操作,并且解决了该问题: a)确保你的R版本是最新的 R release 3.2.3 b)默认源似乎安装Unix版本。所以我手动下载了https://cran.r-project.org/web/packages/pbkrtest/index.html windows版本 c)使用R菜单中的“手动安装”功能安装此软件包。
祝好, Ratan

0
  1. 在控制台中输入version检查R的版本。 如果版本不是"version.string R version 3.3.2"或更高,则
  2. https://cran.r-project.org/bin/windows/base/安装新版本的R。
  3. 使用RStudio中的Tools => Global Options更新R版本。
  4. 在控制台中使用"install.packages("caret")"安装包。
  5. 执行require(caret)
  6. 使用?createDataPartition进行测试。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接