由于未指定“ lib”,因此无法下载ggplot 2

时间:2019-01-16 00:22:48

标签: r ggplot2 rstudio install.packages

过去安装和运行ggplot2没问题,但是突然之间R studio找不到ggplot2软件包。我尝试重新安装该软件包,但是尽管控制台运行了代码并“下载”了该软件包,但library(ggplot2)给了我一个错误:

Error in library(ggplot2) : there is no package called ‘ggplot2’

我已经尝试过:

install.packages("ggplot2",
             repos = c("http://rstudio.org/_packages",
                       "http://cran.rstudio.com"))

我也尝试过:

install.packages("ggplot2", dependencies = TRUE)

我还卸载并重新安装了Rstudio,以admin身份运行,但无济于事

这是控制台在运行命令时显示的内容

install.packages("ggplot2")

控制台输出如下:

Installing package into ‘C:/Users/Keith/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
also installing the dependency ‘rlang’


  There are binary versions available but the source versions are later:
        binary source needs_compilation
rlang    0.2.0  0.3.1              TRUE
ggplot2  2.2.1  3.1.0             FALSE

  Binaries will be installed
trying URL 
'https://cran.rstudio.com/bin/windows/contrib/3.3/rlang_0.2.0.zip'
Content type 'application/zip' length 754726 bytes (737 KB)
downloaded 737 KB

package ‘rlang’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\Keith\AppData\Local\Temp\RtmpmKus85\downloaded_packages
installing the source package ‘ggplot2’

trying URL 'https://cran.rstudio.com/src/contrib/ggplot2_3.1.0.tar.gz'
Content type 'application/x-gzip' length 2863109 bytes (2.7 MB)
downloaded 2.7 MB

* installing *source* package 'ggplot2' ...
** package 'ggplot2' successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck 
= vI[[j]]) : 
  namespace 'rlang' 0.2.0 is being loaded, but >= 0.2.1 is required
ERROR: lazy loading failed for package 'ggplot2'
* removing 'C:/Users/Keith/Documents/R/win-library/3.3/ggplot2'
Warning in install.packages :
  running command '"C:/PROGRA~1/R/R-33~1.1/bin/x64/R" CMD INSTALL -l 
 "C:\Users\Keith\Documents\R\win-library\3.3"
C:\User\Keith\AppData\Local\Temp\RtmpmKus85/downlaoaded_packages/ggplot2_3.1.0.tar.gz' had status 1
Warning in installed.packages:
installation of package 'ggplot2' had non-zero exit status

0 个答案:

没有答案