weathercan
weathercan copied to clipboard
Download multiple years but only certain months
This is a problem and short-term solution reported by John Lewis.
Question: Is it possible to selectively download only winter months across multiple stations and multiple years? Answer: It is possible in the future to implement that for hourly data, but it is currently not implemented (and won't be immediately implemented)
John presented this work-around in the meantime:
library("weathercan")
library("tidyverse")
stations_search("Ottawa", interval = "hour")
#example of downloading data for specific time period(s) during a year
#in this case it is for 4 years of winter hourly data for Ottawa
st <- c("2011-12-14","2012-11-01","2013-11-01","2014-11-01")
ed <-c("2012-03-31","2013-03-31","2014-03-31","2015-03-31")
otta <- vector("list", length(st))
for (i in seq_along(st)){
otta[[i]] <- weather_dl(station_id=49568,start = st[[i]],
end = ed[[i]])
}
otta
##########################
#View(out)
#if you want to combine the data into one large data frame you can
#save the output in a list, then use dplyr::bind_rows(output) to
#combine the output into a single data frame.
ott <- dplyr::bind_rows(otta)
head(ott)
tail(ott)