Efficiently getting older versions of R packages -


a recurring question on package xx not available r version 2.xx.xx. example gplots package requires user have r 3.0 installed in order install. can older versions in archive of cran, but:

  • it not easy see version of package need specific r version.
  • you need build package source, (mild) challenge under windows.

my question following: there more effective workflow in getting older package versions match older version of r? in spirit of having different package repositories different version of ubuntu.

i know 1 option latest version of r, there might pressing reason stick version of r. example, 1 interested in repeating old experiment relies on old version of r , support packages. or 1 limited system administration.

this entirely untested (i'm running latest version of r , have no time @ moment install old version of r test out), perhaps 1 idea grab dates "archive" page package, compare date r version, , progressively try installing earlier versions, starting recent version.

something might starting point:

install_archive <- function(packagename) {   if(!require("xml"))       install.packages("xml")   if(!require("devtools"))       install.packages("devtools")   rversiondate <- as.date(paste(r.version()[c("year", "month", "day")],                                 collapse = "-"))   baseurl <- "http://cran.r-project.org/src/contrib/archive/"   u <- htmlparse(paste(baseurl, packagename, sep = ""))   doc <- readhtmltable(u, skip.rows=1:2)[[1]][2:3]   releasedate <- as.date(strptime(doc$`last modified`,                                    format="%d-%b-%y"))   closest <- which.min(rversiondate -                           releasedate[releasedate <= rversiondate])   install_url(paste(baseurl, doc$name[closest], sep = "")) }   install_archive("reshape") 

from here, add @ least following things function:

  • i first try install current version (not "archive"), , if fails, move ahead.
  • in moving ahead, change which.min() line rank(), , try rank == 1, rank == 2, , on, perhaps setting maximum rank @ try.

even so, lot of "guess , check", software doing guessing , checking automatically. and, of course, same advice holds there reason it's not on cran!


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -