R 报错:package ‘***’ is not available (for R version ****) 的解决方案

时间:2021-12-13 19:56:25

R 安装sparklyr,ggplot2等包出现如下warning

package ‘****’ is not available (for R version 3.0.2)

系统环境 ubuntu14.04

上述问题纠结了我很久,尝试过自己安装packages.zip包,出现了版本不对的报错

this R is version 3.0.2, package 'ggplot2' requires R >= 3.1

于是考虑到升级系统,猜测可能是底层依赖以及R的版本过低,于是运行如下命令在我的电脑里生效了,大家如果遇到可以用此方法试下

sudo add-apt-repository ppa:marutter/rrutter

sudo apt-get update

sudo apt-get upgrade

如果出现如下错误:

Fetched 30.0 MB in 50min 49s (9,832 B/s)                                       
E: Failed to fetch http://ppa.launchpad.net/marutter/rrutter/ubuntu/pool/main/b/boot/r-cran-boot_1.3-17-1trusty0_all.deb  Connection failed

E: Failed to fetch http://ppa.launchpad.net/marutter/rrutter/ubuntu/pool/main/s/survival/r-cran-survival_2.40-1-1~ubuntu14.04.1~ppa1_amd64.deb  Connection failed

E: Failed to fetch http://ppa.launchpad.net/marutter/rrutter/ubuntu/pool/main/r/rpart/r-cran-rpart_4.1-10-1trusty0_amd64.deb  Size mismatch

E: Failed to fetch http://ppa.launchpad.net/marutter/rrutter/ubuntu/pool/main/r/r-cran-class/r-cran-class_7.3-14-1trusty0_amd64.deb  Size mismatch

E: Failed to fetch http://ppa.launchpad.net/marutter/rrutter/ubuntu/pool/main/r/r-cran-nnet/r-cran-nnet_7.3-12-1trusty0_amd64.deb  Size mismatch

E: Failed to fetch http://ppa.launchpad.net/marutter/rrutter/ubuntu/pool/main/r/r-cran-spatial/r-cran-spatial_7.3-10-1trusty0_amd64.deb  Size mismatch

E: Failed to fetch http://ppa.launchpad.net/marutter/rrutter/ubuntu/pool/main/c/codetools/r-cran-codetools_0.2-15-1cran1trusty0_all.deb  Size mismatch

E: Failed to fetch http://ppa.launchpad.net/marutter/rrutter/ubuntu/pool/main/r/r-base/r-base_3.3.2-1trusty0_all.deb  Size mismatch

E: Failed to fetch http://ppa.launchpad.net/marutter/rrutter/ubuntu/pool/main/r/r-base/r-recommended_3.3.2-1trusty0_all.deb  Size mismatch

E: Failed to fetch http://ppa.launchpad.net/marutter/rrutter/ubuntu/pool/main/r/r-base/r-doc-html_3.3.2-1trusty0_all.deb  Size mismatch

E: Failed to fetch http://ppa.launchpad.net/marutter/rrutter/ubuntu/pool/main/r/r-base/r-base-html_3.3.2-1trusty0_all.deb  Size mismatch

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

运行如下命令:sudo apt-get upgrade --fix-missing

R语言的报错比较粗糙,有些时候只是说not available,但并没有告诉你到底哪里不匹配,这里应该算是个小bug,但Mac-OS以及win目前还没遇到过