r - 我在安装 R 包时遇到问题。每当我尝试安装时,都会收到一条非零状态的错误消息。是什么原因?
问题描述
我试图安装重新思考的 R 包。但是,我无法安装该软件包。每当我安装时,R 都会下载该软件包,但由于某种原因无法安装。我什至尝试了包的直接网站,但我最终遇到了同样的问题。我还尝试了另一个包“timetk”。但是,我遇到了同样的错误。让我知道问题所在。谢谢。
代码:
#1。
devtools::install_github("rmcelreath/rethinking")
Downloading GitHub repo rmcelreath/rethinking@HEAD
√ checking for file 'C:\Users\bondb\AppData\Local\Temp\Rtmp2T4bd5\remotes1e442e155feb\rmcelreath-rethinking-3b48ec8/DESCRIPTION' (557ms)
- preparing 'rethinking': (505ms)
√ checking DESCRIPTION meta-information ...
- checking for LF line-endings in source and make files and shell scripts
- checking for empty or unneeded directories
- looking to see if a 'data/datalist' file should be added
- building 'rethinking_2.13.tar.gz' (438ms)
Installing package into ‘C:/Users/bondb/R/win-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package 'rethinking' ...
** using staged installation
** R
** data
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'rethinking'
finding HTML links ... done
AMTL html
Achehunting html
Boxes html
Crofoot html
Dinosaurs html
Dissertations html
Fish html
HMC2 html
HPDI html
finding level-2 HTML links ...
Error: unknown input format
* removing 'C:/Users/bondb/R/win-library/4.0/rethinking'
Error: Failed to install 'rethinking' from GitHub:
(converted from warning) installation of package ‘C:/Users/bondb/AppData/Local/Temp/Rtmp2T4bd5/file1e44343fd58/rethinking_2.13.tar.gz’ had non-zero exit status
#2。
install_github("https://github.com/rmcelreath/rethinking/releases/tag/2.13", force = T)
Downloading GitHub repo rmcelreath/rethinking@2.13
√ checking for file 'C:\Users\bondb\AppData\Local\Temp\Rtmp2T4bd5\remotes1e44223e4eb1\rmcelreath-rethinking-3b48ec8/DESCRIPTION' (511ms)
- preparing 'rethinking': (549ms)
√ checking DESCRIPTION meta-information ...
- checking for LF line-endings in source and make files and shell scripts (416ms)
- checking for empty or unneeded directories
- looking to see if a 'data/datalist' file should be added
- building 'rethinking_2.13.tar.gz' (523ms)
Installing package into ‘C:/Users/bondb/R/win-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package 'rethinking' ...
** using staged installation
** R
** data
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'rethinking'
finding HTML links ... done
AMTL html
Achehunting html
Boxes html
Crofoot html
Dinosaurs html
Dissertations html
Fish html
HMC2 html
HPDI html
finding level-2 HTML links ...
Error: unknown input format
* removing 'C:/Users/bondb/R/win-library/4.0/rethinking'
Error: Failed to install 'rethinking' from GitHub:
(converted from warning) installation of package ‘C:/Users/bondb/AppData/Local/Temp/Rtmp2T4bd5/file1e44327c130/rethinking_2.13.tar.gz’ had non-zero exit status
#3。
install.packages("timetk")
Installing package into ‘C:/Users/bondb/R/win-library/4.0’
(as ‘lib’ is unspecified)
Warning in install.packages :
unable to access index for repository http://xcelab.net/R/bin/windows/contrib/4.0:
cannot open URL 'http://xcelab.net/R/bin/windows/contrib/4.0/PACKAGES'
There is a binary version available but the source version is later:
binary source needs_compilation
timetk 2.6.0 2.6.1 FALSE
installing the source package ‘timetk’
trying URL 'https://cran.rstudio.com/src/contrib/timetk_2.6.1.tar.gz'
Content type 'application/x-gzip' length 3793775 bytes (3.6 MB)
downloaded 3.6 MB
* installing *source* package 'timetk' ...
** package 'timetk' successfully unpacked and MD5 sums checked
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'timetk'
finding HTML links ... done
between_time html
bike_sharing_daily html
box_cox_vec html
condense_period html
diff_vec html
filter_by_time html
filter_period html
fourier_vec html
future_frame html
is_date_class html
lag_vec html
log_interval_vec html
m4_daily html
m4_hourly html
m4_monthly html
m4_quarterly html
m4_weekly html
m4_yearly html
mutate_by_time html
normalize_vec html
pad_by_time html
parse_date2 html
finding level-2 HTML links ...
Error: unknown input format
* removing 'C:/Users/bondb/R/win-library/4.0/timetk'
Warning in install.packages :
installation of package ‘timetk’ had non-zero exit status
解决方案
当您看到消息“finding level-2 HTML links ...”时,程序包生成器正在运行tools::findHTMLlinks(level=2)
以查找帮助文件之间的链接。通常,链接信息在包内缓存为 RDS 文件。这是您可以运行以检查错误可能来自何处的函数运行的代码的变体
check_rds <- function(rds) {tryCatch({readRDS(rds); TRUE}, error=function(x) {FALSE})}
for (x in rev(dir(.libPaths(), full.names = TRUE))) {
is_ok <- if (file_test("-f", f <- file.path(x, "Meta", "links.rds")))
check_rds(f)
else if (file_test("-f", f <- file.path(x, "Meta", "Rd.rds")))
check_rds(f)
else TRUE
if (!is_ok) {
print(paste("bad file", x, f));
}
}
它应该打印它找到的所有坏 RDS 文件。如果没有打印任何内容,则错误必须在其他地方。但如果它确实识别出一个坏文件,那么我建议卸载该特定软件包并重新安装它。
推荐阅读
- r - Ggpairs barDiag 与正态曲线
- ssh - ssh 使用 @ 没有用户名
- r - 如何在r中计算地图上阴影多边形的面积?
- django - Django 2:在哪里添加 urlencode 以正确解析加号
- python - 如何使用漂亮的汤在python中添加href
- javascript - 在 Nuxt JS 中创建 Vue 应用程序之前检查 Firebase onAuthStateChanged
- c++ - 使用正则表达式从文件中删除行注释
- laravel - 如何要求 Laravel 中特定路线的重新输入密码确认?
- go - golang中的ECDH-椭圆/曲线解组失败
- c# - 我无法在以编程方式生成的 docx 文档上放置图像