问题描述
更新R 4.4.0后,出现以下问题:
1. Rstudio打开巨慢,除了Source所有panes都加载不出来,以至于无法运行。
2. 下载包时报错,错误为无法打开镜像且包的version不匹配。具体报错如下例——
Warning in install.packages :
unable to access index for repository http://cran.rstudio.com/src/contrib:
cannot open URL 'http://cran.rstudio.com/src/contrib/PACKAGES'
Warning in install.packages :
package ‘dplyr’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
反复卸载安装最新版本的R 4.4.0和Rstudio,都无济于事。
经试验,以下办法可以解决。
步骤一,卸载R和Rstudio后在C:\Users...\AppData\Local中删除R和Rstudio文件夹,重启,重新安装R和Rstudio。解决办法参考自这里。
步骤二,经过步骤一理论上可以打开Rstudio,但仍有可能遇见panes加载不出来的问题,特别是在打开之前正常使用的Rproject时。这里的可能症结是试图在rmarkdown包被删除的情况下打开rmd文件,所以失败。表征是窗口中上位置会显示“R notebook”持续转圈。
这时需要先安装rmd包,随即可能就遇到上述问题2。
问题2的具体原因不明,但和使用镜像有关,因此可以:
install.packages('rmarkdown', repos='https://cloud.r-project.org')
也有网友通过更换到特定地址镜像、使用http而不是https等手段解决了此问题,参考这里。
哦,以及不要忘了rtools。