knitr::opts_chunk$set(
comment = "#>",
collapse = TRUE,
warning = FALSE,
message = FALSE
)
An FTP client for R
not quite ready to use yet
The File Transfer Protocol (FTP) is a standard network protocol used for the transfer of computer files from a server to a client using the Client–server model on a computer network.
See the ftp info vignette for detailed FTP information.
remotes::install_github("sckott/ftp")
library('ftp')
ftp_list("ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/")
ftp_list("ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/by_year/")
ftp_list("ftp://ftp.ncdc.noaa.gov/pub/data/noaa/2014/")
# just list files
ftp_list("ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/", just_list = TRUE)
url <- "ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/by_year/1882.csv.gz"
file <- tempfile(fileext = ".csv.gz")
ftp_fetch(url, disk = file)
utils::read.delim(file, sep = ",", nrows = 10, header = FALSE)
unlink(file) # cleanup
Wraps an R6 method FTPClient
(x <- ftp_client("ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/"))
adjust settings
x$ftp_port()
x$set_pasv()
pwd, working directory
x$pwd()
list files
x$list()
note that parsing isn't working totally yet :)
ftp
in R doing citation(package = 'ftp')