0

I have installed ggplot2 in R but when I try to load it, R gives this ERROR message:

library(ggplot2)

Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): namespace ‘rlang’ 0.4.6 is already loaded, but >= 0.4.7 is required

What should I do? Thanks in advance.

3
  • Start a new Session, update all Packages, most importantly rlang and try loading ggplot2 again. Commented Aug 14, 2020 at 8:43
  • If that doesn't work, what I usually do is run .libPaths() which shows where your R packages are being installed to. I navigate to that location, manually delete all the folders there. Then reinstall packages using the usual install.packages() etc. That fixes that error message ~90% of the time for me. (note: I don't actually know what the underlying problem is - keen to hear it if someone knows!) Commented Aug 14, 2020 at 8:49
  • OP, it says right in the error your solution. You have rlang version 0.4.6, but you need to use version 0.4.7. Update rlang (install.packages("rlang")), and then you should re-install ggplot2 (install.packages("ggplot2")). That should solve the problem. Commented Aug 16, 2020 at 17:28

2 Answers 2

0

Install the full tidyverse package, it will load all graphics dependencies include gglot2 and its dependencies too.

install.packages("tidyverse")

As mentioned here: https://community.rstudio.com/t/i-cant-load-ggplot2-in-my-library-in-r-version-3-4-3/6466

Sign up to request clarification or add additional context in comments.

Comments

0

I am working on WINDOWS OS and I had same problems with loading ggplot2 and other libraries. I tried to install it like it was suggested in other threads, but it didn't solve the problem. I found some similar issues in other topics, and i figured out that my Rstudio console wanted to have fresh a toolchain bundle called Rtools. It can be downloaded from CRAN REP.

You have to pick appripiote version for your Rengine version. If you do not know what version of R you have, you have to simple type R.version in console, and then download proper version of Rtools. After that, i updated every libraries in Rstudio. ggplot2, tidyverse and many other are working properly from that time

I hope that it could help somebody :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.