1

I have written following code

install.packages('ggplot2', dep = TRUE)
.libPaths(c("C:/Users/Dhanu/Documents/R/win-library/3.3", "C:/Program Files/R/R-3.3.3/library"))
library(ggplot2)

And it is giving me following error after installing ggplot2 library.

> library(ggplot2)
Error in library(ggplot2) : there is no package called ‘ggplot2’
2
  • Why do you change library? Commented Jul 31, 2018 at 16:54
  • Previously I had written code without .libPaths(). But it stil gave me same error. Commented Jul 31, 2018 at 16:56

4 Answers 4

1

Packages are quite sensitive to versions of R you use. I suggest to move to most recent version of R (3.5.1) and then, try to install ggplot2

R version 3.5.1 (2018-07-02) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
...
...
> install.packages('ggplot2')
...
> library(ggplot2)
> 
Sign up to request clarification or add additional context in comments.

4 Comments

Do you have to stick to 3.3? In that case, you can always try to install from sources.
You can alternatively try to use older release: cloud.r-project.org/bin/windows/contrib/3.3/ggplot2_2.2.1.zip and then, install it using: install.packages(''ggplot2_2.2.1.zip", repos = NULL, type = "win.binary")
I keep my fingers crossed ;)
.oOo. Cool! Have fun with R! .oOo.
0

Can you please check whether ggplot folder available in your current working directory C:/Users/Dhanu/Documents/R/win-library/3.3"

Comments

0

Installed latest version of R and problem is solved by again installing the library

Comments

0

Tools > Global Options > R Version(Change) > Use your machine's default version

Then you need to update your R (https://cran.r-project.org/) and install all packages again

Comments

Your Answer

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