简体   繁体   中英

Why is the ggplot2 installation failing?

I'm trying to install the ggplot2 package, so that I make use of ggplot function for my graphs but it keeps failing me. Where is the problem?

>  install.packages("ggplot2")
Installing package into ‘C:/Users/Augustinho/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)

  There is a binary version available but the source version is later:
        binary source needs_compilation
ggplot2  3.3.0  3.3.1             FALSE

installing the source package ‘ggplot2’

trying URL 'https://cran.stat.unipd.it/src/contrib/ggplot2_3.3.1.tar.gz'
Content type 'application/octet-stream' length 3035612 bytes (2.9 MB)
downloaded 2.9 MB

* installing *source* package 'ggplot2' ...
** package 'ggplot2' successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Error : .onLoad failed in loadNamespace() for 'pillar', details:
  call: utils::packageVersion("vctrs")
  error: package 'vctrs' not found
ERROR: lazy loading failed for package 'ggplot2'
* removing 'C:/Users/Augustinho/Documents/R/win-library/3.5/ggplot2'
In R CMD INSTALL

The downloaded source packages are in
        ‘C:\Users\Augustinho\AppData\Local\Temp\RtmpM7MaYn\downloaded_packages’
Warning messages:
1: In readRDS(dest) : lzma decoding result 10
2: In install.packages("ggplot2") :
  installation of package ‘ggplot2’ had non-zero exit status
> library(ggplot2)
Error in library(ggplot2) : there is no package called ‘ggplot2’

As you are on Windows, try to install the binary version with dependencies:

install.packages("ggplot2",
                 type = "binary",
                 dependencies = TRUE,
                 repos = "https://cloud.r-project.org")

Edit:

Helped first running:

install.packages("vctrs", type = "binary", dependencies = TRUE, repos = "https://cloud.r-project.org")

to skip some vctrs installation error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM