[英]R: Many problems with updates or installation of packages after updating R or RStudio
I have been having a rash of problems when I do R or RStudio updates. 我在进行R或RStudio更新时遇到了很多问题。 I get a lot of these problems over the next few sessions after an update. 更新后的接下来的几个会议中,我遇到了很多这些问题。 Is the problem apparent on this information? 在此信息上问题是否明显? If not, how can I diagnose it? 如果没有,我该如何诊断?
Problems take the following forms: 问题采用以下形式:
tidyverse
packages. 最常见的是这些tidyverse
软件包。 stringi
. 未安装tidyverse的某些依赖项,尤其是stringi
。 Similar problems occur less often with Hmisc
. Hmisc
很少发生类似的问题。 I get similar problems if I try to update tidyverse
with tidyverse_update
, eg: 如果尝试使用tidyverse_update
更新tidyverse
, tidyverse_update
遇到类似的问题,例如:
tidyverse::tidyverse_update(recursive = TRUE) Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called 'readr' tidyverse :: tidyverse_update(recursive = TRUE)loadNamespace(j <-i [[1L]],c(lib.loc,.libPaths()),versionCheck = vI [[j]])中的错误:没有称为'readr'
This although the readr package is in fact present. 尽管实际上存在阅读器包。
I just now got a new error message on trying to install readr individually: 我现在收到有关尝试单独安装阅读器的新错误消息:
Warning in install.packages: lzma decoding result 10 Warning in install.packages: unable to access index for repository https://cran.case.edu/bin/windows/contrib/3.5 : Line starting 'Pac ...' is malformed! install.packages中的警告:lzma解码结果10 install.packages中的警告:无法访问存储库https://cran.case.edu/bin/windows/contrib/3.5的索引:以'Pac ...'开头的行格式错误!
And on trying again: 再试一次:
Error in install.packages : invalid version specification ‘NA’
I usually start a session with update.packages(ask=FALSE)
. 我通常以update.packages(ask=FALSE)
开始会话。 I have RStudio set up to always run as Administrator. 我已将RStudio设置为始终以管理员身份运行。 If asked, I generally install from binaries rather than source. 如果询问,我通常从二进制文件而不是源文件进行安装。
I install and load groups of packages using the following functions: 我使用以下功能安装和加载软件包组:
# Install packages (if not already installed)
in_packs <- function(packs){
new_packs <- packs[!(packs %in% installed.packages()[,"Package"])]
if(length(new_packs) < 1) print("Already installed.") else {
install.packages(new_packs, dependencies = TRUE, # move to fairR_fns
repos=c("https://cran.case.edu/",
"https://cran.rstudio.com"))
# Load packages (if not already installed)
load_pks <- function(pks){
invisible(sapply(X = pks[seq_along(pks)], FUN = library, character.only = TRUE))
}
Here is my session information. 这是我的会议信息。
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_1.0.0 lubridate_1.7.4 lattice_0.20-38 tidyr_0.8.2
[5] assertthat_0.2.0 digest_0.6.18 R6_2.3.0 plyr_1.8.4
[9] backports_1.1.3 httr_1.4.0 ggplot2_3.1.0 pillar_1.3.1
[13] rlang_0.3.0.1 lazyeval_0.2.1 stringr_1.3.1 munsell_0.5.0
[17] broom_0.5.1 compiler_3.5.1 modelr_0.1.2 pkgconfig_2.0.2
[21] tidyselect_0.2.5 tibble_1.4.2 crayon_1.3.4 dplyr_0.7.8
[25] grid_3.5.1 nlme_3.1-137 jsonlite_1.6 gtable_0.2.0
[29] magrittr_1.5 scales_1.0.0 cli_1.0.1 stringi_1.2.4
[33] bindrcpp_0.2.2 generics_0.0.2 tools_3.5.1 forcats_0.3.0
[37] glue_1.3.0 purrr_0.2.5 hms_0.4.2 yaml_2.2.0
[41] colorspace_1.3-2 memoise_1.1.0 bindr_0.1.1 haven_2.0.0
I have found that most, though by no means all, of these problems go away if I do the following: 我发现如果执行以下操作,大多数(尽管不是全部)问题都会消失:
This is a little tricky because the instantiation of RI am running is usually opened by RStudio, not by me. 这有点棘手,因为正在运行RI的实例化通常是由RStudio打开的,而不是我打开的。 For both RStudio and R, right-click on the shortcut, either on the desktop or the start menu. 对于RStudio和R,在桌面或开始菜单上的快捷方式上单击鼠标右键。 On the shortcut tab, select advanced. 在快捷方式选项卡上,选择高级。 Then check the box for run as administrator. 然后选中以管理员身份运行的框。 I also allow the R directory in program files to be modified by other programs, though I am not sure this was necessary. 我也允许其他程序修改程序文件中的R目录,尽管我不确定这是否必要。 Right-click, properties, Security tab, select ALL APPLICATION PACKAGES, click on edit, check on Full control. 右键单击属性,在“安全性”选项卡上,选择“所有应用程序包”,单击“编辑”,然后选中“完全控制”。
Of the problems that remain when these things have been done, most seem to be caused by, usually short-term, problems with the repository copy. 完成这些操作后仍然存在的问题中,大多数似乎通常是由短期的存储库副本问题引起的。 Such problems can disturb not only the corrupted (or whatever) package, but also its dependencies. 这样的问题不仅会打乱损坏的(或其他)程序包,而且还会打扰其依赖性。 Delete the folder of the problem package manually, restart R and, before loading any packages, switch to a different repository. 手动删除问题软件包的文件夹,重新启动R,然后在加载任何软件包之前切换到其他存储库。 Then install as usual 然后照常安装
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.