if (FALSE) {
# Get data
ghcnd(stationid = "AGE00147704")
stations <- ghcnd_stations()
ghcnd(stations$id[40])
library("dplyr")
ghcnd(stations$id[80300]) %>% select(id, element) %>% slice(1:3)
# manipulate data
## using built in fxns
dat <- ghcnd(stationid = "AGE00147704")
(alldat <- ghcnd_splitvars(dat))
## using dplyr
library("dplyr")
dat <- ghcnd(stationid = "AGE00147704")
filter(dat, element == "PRCP", year == 1909)
# refresh the cached file
ghcnd(stationid = "AGE00147704", refresh = TRUE)
# Read in a .dly file you've already downloaded
path <- system.file("examples/AGE00147704.dly", package = "rnoaa")
ghcnd_read(path)
# change the base url for data requests
Sys.setenv(RNOAA_GHCND_BASE_URL =
"https://ncei.noaa.gov/pub/data/ghcn/daily/all")
ghcnd(stations$id[45], verbose = TRUE)
## must be in the allowed set of urls
# Sys.setenv(RNOAA_GHCND_BASE_URL = "https://google.com")
# ghcnd(stations$id[58], verbose = TRUE)
}
Run the code above in your browser using DataLab