try({ # fails when no internet available
from <- FileReferences(c("http://bioconductor.org/biocLite.R",
"http://bioconductor.org/index.html"))
## to R's temporary directory
to <- retrieve(from)
urls(to)
localNames(to)
## tell R where to copy files to
toDir <- tempfile()
dir.create(toDir, recursive=TRUE)
toUrls <- file.path(toDir, localNames(from))
retrieve(from, FileReferences(toUrls))
list.files(toDir)
})
Run the code above in your browser using DataLab