pkgs <- c(mathjaxr="2.0-0",metadat="1.6-0",numDeriv="2016.8-1.1",pbapply="1.7-5",digest="0.6.39",jsonlite="2.0.0",metafor="5.2-1"); for (nm in names(pkgs)) { v <- pkgs[[nm]]; u <- paste0("https://cran.r-project.org/src/contrib/",nm,"_",v,".tar.gz"); dst <- tempfile(fileext=".tar.gz"); ok <- try(download.file(u,dst,quiet=TRUE),silent=TRUE); if(inherits(ok,"try-error")) download.file(paste0("https://cran.r-project.org/src/contrib/Archive/",nm,"/",nm,"_",v,".tar.gz"),dst,quiet=TRUE); install.packages(dst,repos=NULL,type="source"); stopifnot(packageVersion(nm)==package_version(v)) }
