一、Q1 安装包报错
直接用install.pakages(""),会报错:
installation of package had non-zero exit status
安装包有非零退出状态
ERROR: dependencies 'plyr', 'digest', 'gtable', 'reshape2', 'scales', 'proto' are not available for package 'ggplot2'
解决办法:
用这个install.packages("stringi", dependencies=TRUE, INSTALL_opts = c('--no-lock'))真的解决问题了,stringi包,其他包都可以用这个方法解决
二、Q2 某些包版本不支持
Warning: unable to access index for repository https://mirrors.eliteu.cn/CRAN/src/contrib:
cannot open URL 'https://mirrors.eliteu.cn/CRAN/src/contrib/PACKAGES'
Warning message:
package ‘x12’ is not available (for R version 3.5.3)
为避免这种情况,可以设置CRAN使用清华大学镜像,命令如下:
options(repos=structure(c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/")))
安装好了就可以用library调用了。