ftp

ftp for R

OTHER License

Stars
28
Committers
1

ftp

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.

Installation

remotes::install_github("sckott/ftp")
library('ftp')

list files

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)

fetch files

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

ftp client

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 :)

Meta

  • Please report any issues or bugs.
  • License: MIT
  • Get citation information for ftp in R doing citation(package = 'ftp')
  • Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.