I'm failing to update ggplot2, any suggestions please?!

Oh well I tried today, and it seems that getting the more recent version of ggplot2 requires a newer version of rlang.

So I also tried to remove the older rlang and replace with a newer, but I couldn't make that work either.

And in the process I seem to have completely removed ggplot2 from my system, and I've tried to reinstall but it doesn't seem to be working:

Warning in install.packages :
installation of package ‘ggplot2’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/6q/5g00q97d24z6jg9qwbf0g4x80000gn/T/RtmpcUWv5T/downloaded_packages’

Unfortunately I don't know what that means!

What happens if you just run the following:

install.packages("ggplot2")

I've tried that a couple of times, but the details in the console then always end with this:

Warning in install.packages :
installation of package ‘ggplot2’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/6q/5g00q97d24z6jg9qwbf0g4x80000gn/T/RtmpcUWv5T/downloaded_packages’

In the list of packages, I can see ggplot2 (version 2.2.1), but the check box next to it is unticked. I've tried to install from the packages list too, but same result.

Could you post the whole error message? you are omiting the useful parts

Of course, here we are (sorry, I'm new to R this is well outside my comfort zone!):

install.packages("ggplot2")

There is a binary version available but the source version is later:
binary source needs_compilation
ggplot2 3.1.0 3.2.0 FALSE

installing the source package ‘ggplot2’

trying URL 'https://cran.rstudio.com/src/contrib/ggplot2_3.2.0.tar.gz'
Content type 'application/x-gzip' length 3193995 bytes (3.0 MB)

downloaded 3.0 MB

Warning in strptime(xx, f <- "%Y-%m-%d %H:%M:%OS", tz = tz) :
unknown timezone 'zone/tz/2019a.1.0/zoneinfo/Europe/London'

  • 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 ‘pkgconfig’ 2.0.1 is being loaded, but >= 2.0.2 is required
    ERROR: lazy loading failed for package ‘ggplot2’
  • removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/ggplot2’
  • restoring previous ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/ggplot2’
    Warning in install.packages :
    installation of package ‘ggplot2’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/6q/5g00q97d24z6jg9qwbf0g4x80000gn/T/RtmpcUWv5T/downloaded_packages’

This is telling you that you have to update this package dependency, try installing it first with

install.packages("pkgconfig")

If everything goes well, then you can try to install ggplot2 again, but this time try with this command

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

Well that seems to have worked!

I don't understand the huge lines of content that ran through the console while it was working, but I can now see a more recent version of ggplot2 in my packages list (hurrah! that means I should be able to load ggtern) and I just loaded ggplot2 and ran one of my histograms and it worked a dream.

Thank you very much, this means a great deal to me. With more practice and experience I can only become more proficient in R, but it's support of people who know what they are doing that makes it possible.

I'm glad I could help If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

I've done just that.

Unfortunately I now have a related problem, trying to access ggtern. Does this (below) mean that I first need to get the package 'robust base' before being able to use ggtern?

library(ggtern)
Error: package or namespace load failed for ‘ggtern’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘robustbase’
In addition: Warning message:
package ‘ggtern’ was built under R version 3.4.4

yes, you are starting to get it

Right! So I use install.package() for that I think.

Just to add a note here, usually you don't need to install the dependencies separately. install.packages defaults to dependencies = NA, i.e. c("Depends", "Imports", "LinkingTo"). If you use TRUE (as Andres did in his solution above), it adds Suggests to the aforementioned list.

Since it seems that it doesn't seem to work for you, and you received this warning message, I think that there's a chance your R version is outdated. You can update it to the latest version 3.6.1, which will probably be useful.

Thank you for explaining that. I'm using R Studio (and I'm in the most recent version of that), because that's how R was introduced to me. What does that mean I have to do if I want to make use of ggtern?

RStudio is an Integrated Development Environment for working with R but they are two independent pieces of software, so installing the latest version of RStudio doesn't mean that you have the latest version of R, maybe this will clarify things for you

Got it! So I can work in R rather than R Studio to make a ternary plot and see how some data from my archaeological quarry site turns out.

Yes, you can, but I see no reason to do it, using R through RStudio is much easier and convenient.

Yarnabrina's advice about updating R is just to save you further problems when installing or updating packages.

Oh I see. So...I know the version of R Studio that I'm using is up to date, what should I do to ensure that I update R?

Download and install the latest version from CRAN

https://cran.r-project.org/bin/macosx/

Thanks for the link. I will also look for other answers to this question to see if there is anything I need to be aware of. :+1:

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