新买的Mac,安装了Rstudio。使用时,出现成功安装加载ggplot2后,却不能使用ggplot和qplot。错误是不存在叫‘farver’这个名字的程辑包:
> qplot(mpg, wt, data = mtcars)
Error in loadNamespace(name) : 不存在叫‘farver’这个名字的程辑包
> ggplot(mtcars, aes(mpg,wt))+ geom_point()
Error in loadNamespace(name) : 不存在叫‘farver’这个名字的程辑包
解决方法:
在Rstudio画图和函数包帮助窗口中,单独安装‘farver’包。成功后,就可以使用ggplot了。
我也尝试了其他方法,但都失败了,在此记录:
1、代码和手动重装ggplot2, 不可行
2、接外网VPN,再次重装ggplot2, 不可行
3、写代码单独装‘farver’包,不可行,错误提示如下:
> install.packages("farver")
试开URL’https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/farver_2.0.3.tgz'
Content type 'application/x-gzip' length 1828397 bytes (1.7 MB)
========================================
downloaded 1.4 MB
Warning in install.packages :
downloaded length 1473846 != reported length 1828397
Warning in install.packages :
URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/farver_2.0.3.tgz': status was 'Failure when receiving data from the peer'
Error in download.file(url, destfile, method, mode = "wb", ...) :
download from 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/farver_2.0.3.tgz' failed
Warning in install.packages :
download of package ‘farver’ failed
显示两个Warning,“downloaded length 1473846 != reported length 1828397”和“status was Failure when receiving data from the peer”。因为我看不懂,所以无法解释。