Upgrading ggplot2

I'm currently on ggplot2 version 3.3.2, and R version 3.6.1. I understand to use ggally, I need to be on ggplot2 3.3.4 or higher. But I'm having trouble upgrading ggplot2.

I tried

> update.packages("ggplot2")

It prompted me to pick a CRAN mirror, but nothing happened after. ggplot2 is still on version 3.3.2 after.

Is it possible that I also need to upgrade R itself? Here's what my R sessionInfo() and repos look like

> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-conda_cos6-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /mnt/nfs/USERNAME/lib/R/lib/libRblas.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.6.1

and

> getOption("repos")
    CRAN 
"@CRAN@" 

Is it possible my R is pinned to a version that doesn't allow for upgrading of ggplot2?

{ggplot2} only requires R 3.4 or greater, so that's not the problem, but see this post to fix repo problem. You should consider updating R; lagging behind by a version and its two point releases will lead to difficulties.

I don't have a problem with ggplot2. I've been using ggplot2 3.3.2 for a long time on my existing R with no problems.

My issue is that I want to use ggally, which apparently needs ggplot2 3.3.4. I am not sure how to proceed.

The current version of {ggplot2} will run on your version of R and {ggally} will also. With

update.packages("ggplot2")

you should be able to install {ggally}.

What is the complete console output you get when you run this command?

install.packages("ggplot2")
install.packages("ggplot2")

Actually worked just fine. Got me to 3.4.0. And then I was able to do the same for GGally. So I'm off to the races.

Was my mistake in doing update.packages("ggplot2") instead of install.packages("ggplot2")? What's the difference between these 2?

1 Like

My bad. update.packages() sometimes work but install.packages() always works, assuming it works at all (i.e., no compilation problems).

By passing "ggplot2" as an unnamed argument you were actually telling the function to use "ggplot2" as the lib.loc argument (the location of an R package library in your system), and that is most certainly not a valid location. I think you need to use the oldPkgs argument for specifying which packages to consider.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.