Warning in install.packages : package ‘ggplot2’ is not available (for R version 3.6.1)

Warning in install.packages :

Warning in install.packages :
  package ‘ggplot2’ is not available (for R version 3.6.1)
Warning in install.packages :
  unable to access index for repository https://cran.rstudio.com/bin/windows/contrib/3.6:
  cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/PACKAGES'

This suggest you are not being able to connect to the CRAN repository. Is your internet connection behind a proxy server or firewall? That is usually the case when you are at work or school.

Try this:

install.packages("ggplot2")

Then call out the library using:

library("ggplot2")
Goodluck.

Hi @Hakeem!

Thanks for suggesting a solution. It's true that often people get confused because installing a package isn't the same thing as loading it!

However, the original problem seemed to be a common error message that comes from install.packages() when R can't reach the internet, so I suspect that the internet connection problem would need to be resolved before the questioner could take your advice.

I agree with you, @jcblum.