GregF
GregF

Reputation: 1392

R 3.2.3 devtools::install_version() fails (.zip file not found)

I'm trying to leave instructions for how to set up an R environment as similar as possible to mine on Windows. I found this stackoverflow thread, which was really helpful: Installing older version of R package

I can get most packages to work using the "versions" package, which pulls from MRAN. However, a few packages are not available on MRAN (because they were published too long ago).

So I tried to use the devtools::install_version() option. However, I have found that I get the following error:

devtools::install_version("proj4", version = "1.0-8")
#> trying URL 'https://cran.rstudio.com/src/contrib/proj4_1.0-8.zip'
#> Error in download.file(url, destfile, method, mode = "wb", ...) : 
#>   cannot open URL 'https://cran.rstudio.com/src/contrib/proj4_1.0-8.zip'
#> In addition: Warning message:
#> In download.file(url, destfile, method, mode = "wb", ...) :
#>   cannot open URL 'https://cran.rstudio.com/src/contrib/proj4_1.0-8.zip': HTTP status was '404 Not Found'
#> Warning in download.packages(pkgs, destdir = tmpd, available = available,  :
#>   download of package ‘animation’ failed

By navigating around the website, I think that the CRAN no longer posts .zip files, but there is a .tar.gz file:

https://cran.rstudio.com/src/contrib/proj4_1.0-8.tar.gz

I believe that I still could install a .tar.gz file, but I don't know how to make R do it for me.

I'm hoping that someone here can help me with a solution that gets devtools::install_version() to work on R 3.2.3. (If the only solution is to install version 3.2.4, then I could probably make that work, too, but would prefer not to)

I'd also appreciate some pointers explaining how these packages are stored. In particular, it seems possible that I could just copy the folders out of my library and have someone else put them into theirs, and things will work (as long as they are also using windows(?)). Or would I have to build binaries? If so, how would I do that? This way I could have the devtools::install_version() method only as a backup.

Thanks!

Upvotes: 0

Views: 3787

Answers (1)

csgillespie
csgillespie

Reputation: 60492

When you install a package, devtools get the type from

getOption("pkgType")

To install the source version, i.e. the tar.gz file, just specify the argument

devtools::install_version("proj4", version = "1.0-8", type="source")

I'm presuming you're using Windows, so you may have to install Rtools as well.

Upvotes: 2

Related Questions