## helper to fill in files from CRAN missing in the local CRANberries store
cran <- fread("zcat inst/data/cran.csv.gz")
setnames(cran, c("path","size","time"))
oldcran <- cran[ grepl("^contrib/Archive/.*tar.gz", path),]
oldcran[, path:=gsub("contrib/Archive/", "", path),]
oldcran[, pkg := gsub("^(.*)/.*", "\\1", path)]
oldcran[, pkgver := gsub("^.*/(.*)", "\\1", path)]
setkeyv(oldcran, c("pkg", "time"))
oldcran[, newest := (pkgver == last(pkgver)), by=pkg]
oldpkgs <- oldcran[newest==TRUE,] ## 14009 package !!
## packages for which we need the targz to fill in
#berries[nativeornot[is.na(NeedsCompilation)==TRUE, .(Package)], .(pkg, file)][is.na(file)==TRUE][,.(pkg)]
## so join with oldpkgs, and pick subset we need
toget <- oldpkgs[ berries[nativeornot[is.na(NeedsCompilation)==TRUE, .(Package)], .(pkg, file)][is.na(file)==TRUE] ][, .(pkg,pkgver,time)]
setwd("/tmp/new")
for (i in seq_len(nrow(toget))) {
r <- toget[i,]
url <- paste0("https://cloud.r-project.org/src/contrib/Archive/", r$pkg, "/", r$pkgver)
#print(url)
download.file(url, destfile=r$pkgver)
cmd <- paste("touch -t", format( anytime::anytime(r$time), "%Y%m%d%H%M"), r$pkgver)
#print(cmd)
system(cmd)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.