Description Usage Arguments Details Value Examples
Fetch files from an FTP server
1 |
url |
(character) URL for the file on the FTP server |
disk |
(character) a path to write to. if |
stream |
(character) an R function to determine how to stream
data. if |
messages |
(logical) verbose messages. Default: |
... |
further args passed on to curl |
Only one of disk
or stream
parameters can be passed
string, path to the file on disk
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Not run:
url <- "ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/by_year/1882.csv.gz"
# disk
file <- tempfile(fileext = ".csv.gz")
ftp_fetch(url, disk = file)
utils::read.delim(file, sep = ",", nrows = 10, header = FALSE)
unlink(file) # cleanup
# stream - NOT WORKING QUITE YET
lst <- c()
fun <- function(x) lst <<- c(lst, x)
ftp_fetch(url, stream = fun)
lst
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.