Description Usage Arguments Methods Examples
This method retrieve files referenced by its first argument to
locations determined by its second argument. The return value is a
FileReferences object summarizing the
destination.
1 |
from |
The source from which objects will be retrieved; typically (or exclusively, depending on method) ‘remote’ locations accessible via, e.g., http. |
to |
The destination to which files will be copied; typically on the local file system. |
... |
Additional arguments, passed to the function performing the download. |
from contains
remote urls; files must be retrievable using getBinaryURL
from the RCurl package. ... arguments are passed to
getBinaryURL. to is a directory name to which files
will be copied; the directory is created if it does not exist. File
names will be unique.
from is
as in retrieve,FileReferences,character-method. to
specifies destination urls; urls(to) must have the same
number of elements as urls{from}, must not already exist on
the local file system, and must not require creation of new
directories. localNames and types of to are
replaced by corresponding elements from from.
from is as in
the retrieve,FileReferences,character-method. The destination
is created using tempfile(), and forwarding this as the
second argument to
retrieve,FileReferences,character-method. The effect is to
retrieve files to R's temporary directory; these files will be
removed when the R session ends.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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)
})
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.