1

I am unable to install ggplot2 package. I tried running below code.

install.packages("ggplot2")
 also installing the dependencies ‘stringi’, ‘colorspace’, ‘Rcpp’,     ‘stringr’, ‘munsell’, ‘plyr’, ‘digest’, ‘reshape2’, ‘scales’

trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/stringi_1.0-1.zip'
Content type 'application/zip' length 14265659 bytes (13.6 MB)
downloaded 13.6 MB

trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/colorspace_1.2-6.zip'
Content type 'application/zip' length 392857 bytes (383 KB)
downloaded 383 KB

trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/Rcpp_0.12.2.zip'
Warning in install.packages :
InternetOpenUrl failed: 'The operation timed out'
Error in download.file(url, destfile, method, mode = "wb", ...) : 
cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/Rcpp_0.12.2.zip'
Warning in install.packages :
 download of package ‘Rcpp’ failed
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/stringr_1.0.0.zip'
Content type 'application/zip' length 83159 bytes (81 KB)
downloaded 81 KB

trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/munsell_0.4.2.zip'
Content type 'application/zip' length 125762 bytes (122 KB)
downloaded 122 KB

trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/plyr_1.8.3.zip'
Warning in install.packages :
InternetOpenUrl failed: 'The operation timed out'
Error in download.file(url, destfile, method, mode = "wb", ...) : 
cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/plyr_1.8.3.zip'
Warning in install.packages :
download of package ‘plyr’ failed
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/digest_0.6.8.zip'
Content type 'application/zip' length 151939 bytes (148 KB)
downloaded 148 KB

trying URL 

'http://cran.rstudio.com/bin/windows/contrib/3.2/reshape2_1.4.1.zip'
  Warning in install.packages :
  InternetOpenUrl failed: 'The operation timed out'
  Error in download.file(url, destfile, method, mode = "wb", ...) : 
  cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/reshape2_1.4.1.zip'
  Warning in install.packages :
  download of package ‘reshape2’ failed
  trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/scales_0.3.0.zip'
  Warning in install.packages :
  InternetOpenUrl failed: 'The operation timed out'
  Error in download.file(url, destfile, method, mode = "wb", ...) : 
  cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/scales_0.3.0.zip'
  Warning in install.packages :
  download of package ‘scales’ failed
  trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/ggplot2_1.0.1.zip'
  Warning in install.packages :
  InternetOpenUrl failed: 'The operation timed out'
  Error in download.file(url, destfile, method, mode = "wb", ...) : 
  cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/ggplot2_1.0.1.zip'
  Warning in install.packages :
  download of package ‘ggplot2’ failed
  package ‘stringi’ successfully unpacked and MD5 sums checked
  package ‘colorspace’ successfully unpacked and MD5 sums checked
  package ‘stringr’ successfully unpacked and MD5 sums checked
  package ‘munsell’ successfully unpacked and MD5 sums checked
  package ‘digest’ successfully unpacked and MD5 sums checked

I tried installing the plyr package individually but I got the same error

InternetOpenUrl failed: 'The operation timed out'

while installing the dependency package Rcpp and plyr also failed

mockash
  • 1,204
  • 5
  • 14
  • 26
  • How to select a mirror? I didn't get that option to select any mirror @Pascal – mockash Dec 10 '15 at 06:40
  • What is your OS? Are you installing through RStudio? If on Linux, do you have any `Rprofile` file in your home? –  Dec 10 '15 at 06:41
  • @Pascal I am working on windows 7 and yes installing through RStudio and my R version is 3.2. Just to add to that I also tried downloading the .tar file from CRAN and install the package. but that also failed. – mockash Dec 10 '15 at 06:46
  • You can change the default mirror in RStudio. Search in Tools > Global Options –  Dec 10 '15 at 06:51
  • 2
    Possible duplicate of [Unable to install packages in latest version of RStudio and R Version.3.1.1](http://stackoverflow.com/questions/25599943/unable-to-install-packages-in-latest-version-of-rstudio-and-r-version-3-1-1) –  Dec 10 '15 at 07:11
  • @Pascal your suggestion was helpful. I did this and it has worked. 1- In Tools -> Global Options -> Packages, uncheck the "Use Internet Explorer library/proxy for HTTP" option, 2- In Tools -> Global Options -> Packages, change the CRAN mirror to "0- Cloud - Rstudio, automatic redirection to servers worldwide" 3- Restart Rstudio. – mockash Dec 10 '15 at 07:24

1 Answers1

2

Try and see if the following syntax works for you:

install.packages("ggplot2", dependencies = TRUE, repos = "http://cran.rstudio.com/")

Mirror names can be changed via "repos".

ruchijain90
  • 181
  • 6