hcd_download | R Documentation |
Downloads raw CSV data files from the Canadian Historical Climate Data website. These are the raw files you would obtain if you accessed a data record through the HCD website.
hcd_download(
station,
file,
dir = tempdir(),
timescale = c("monthly", "daily", "hourly"),
year = NULL,
month = NULL,
progress = TRUE
)
station |
character; one or more HCD station IDs. |
file |
character; one or more file names. If not supplied, file names
of the form |
dir |
character; vector of one or more directory paths in which CSV files will be saved.scale of the requested Historical Climate Data records. If multiple paths supplied, there should be one path per station. |
timescale |
character; the timescale of the requested Historical Climate Data records. |
year |
numeric; vector of one or more years. Needed for daily or hourly data only. |
month |
numeric; vector of one or months. Needed for hourly data only. |
progress |
logical; if |
A character vector containing file paths to the downloaded CSVs is returned invisibly.
Gavin L. Simpson
f <- hcd_download(1707, timescale = "monthly")
file.exists(f)
## specifying multiple storage folders
dirs <- file.path(tempdir(), c("2855", "1707"))
dir.create(dirs[1])
dir.create(dirs[2])
f <- hcd_download(c(2855, 1707), timescale = "monthly", dir = dirs)
file.exists(f)
## ...and daily
f <- hcd_download(c(2855, 1707), timescale = "daily", dir = dirs,
year = 1999:2000)
file.exists(f)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.