0

I'm new to installing packages and R, It looks like my devtools library is missing.

I was trying to install swirl, I got the following message :

> install.packages("swirl")
Installing package into ‘C:/Users/cory/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Warning: failed to download mirrors file (cannot open destfile 'C:\Users\cory\AppData\Local\Temp\RtmpuA5tgZ\filef6c6874433a', reason 'No such file or directory'); using local file 'C:/PROGRA~1/R/R-35~1.1/doc/CRAN_mirrors.csv'
Warning: unable to access index for repository https://cran.cnr.berkeley.edu/src/contrib:
  cannot open destfile 'C:\Users\cory\AppData\Local\Temp\RtmpuA5tgZ\filef6c4b9547', reason 'No such file or directory'
Error in gzfile(file, mode) : cannot open the connection
In addition: Warning messages:
1: package ‘swirl’ is not available (for R version 3.5.1) 
2: In gzfile(file, mode) :
  cannot open compressed file 'C:\Users\cory\AppData\Local\Temp\RtmpuA5tgZ/libloc_194_4cc5b48b.rds', probable reason 'No such file or directory'

I then tried the following :

> library(devtools)
Error in library(devtools) : there is no package called ‘devtools’

So I downloaded devtools in zip format and tried loading it

> getwd()
[1] "C:/Users/cory/Documents"

I downloaded the devtools zip in the same folder, and renamed it to devtoolz zip I tried running the command again

> install.packages("devtools")
Installing package into ‘C:/Users/cory/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
Warning: unable to access index for repository http://cran.rstudio.com/src/contrib:
  cannot open destfile 'C:\Users\cory\AppData\Local\Temp\RtmpuA5tgZ\filef6c77f36a9', reason 'No such file or directory'
Error in gzfile(file, mode) : cannot open the connection
In addition: Warning messages:
1: package ‘devtools’ is not available (for R version 3.5.1) 
2: In gzfile(file, mode) :
  cannot open compressed file 'C:\Users\cory\AppData\Local\Temp\RtmpuA5tgZ/libloc_194_4cc5b48b.rds', probable reason 'No such file or directory'

What steps should I take to get the devtools installed? Many thanks! :)

r2evans
  • 141,215
  • 6
  • 77
  • 149
Cory
  • 1
  • 1
  • 1
  • Is it possible that you're using a computer with an internet connection through an employer that might be blocking/filtering specific sites? This looks more like firewall/proxy issues to me. – joran Aug 31 '18 at 17:53
  • For instance, the error messages you're getting seem more similar to the issue [here](https://stackoverflow.com/a/33283585/324364). – joran Aug 31 '18 at 17:54
  • If `install.packages` fails, I don't understand why you'd expect `library` to work. If you then download a package zip file but try the original (internet-downloading) method, why would it behave differently? Perhaps https://stackoverflow.com/q/1474081/3358272 would be useful, where they discuss installing via zip file. – r2evans Aug 31 '18 at 18:01

2 Answers2

0

I found a way around this, In case it helps someone else :

*In Rstudio, it tuns out it is possible to install a package without downloading locally and without pointing to an URL (which I also had tried). Because it is integrated with CRAN-mirrors, I was able to simply type devtools in the box and select it from the existing drop-down menu.

It proved more efficient than trying to manually import it through RGui.*

Cory
  • 1
  • 1
  • 1
0

I had the same issue, I just closed my RStudio and opened it, and it worked.