## Not run:
# # Get station table
# stations <- isd_stations()
# head(stations)
#
# ## plot stations
# ### remove incomplete cases, those at 0,0
# df <- stations[complete.cases(stations$lat, stations$lon), ]
# df <- df[df$lat != 0, ]
# ### make plot
# library("leaflet")
# leaflet(data = df) %>%
# addTiles() %>%
# addCircles()
#
# # Get data
# (res <- isd(usaf="011490", wban="99999", year=1986))
# (res <- isd(usaf="011690", wban="99999", year=1993))
# (res <- isd(usaf="172007", wban="99999", year=2015))
# (res <- isd(usaf="702700", wban="00489", year=2015))
# (res <- isd(usaf="109711", wban=99999, year=1970))
#
# # The first time a dataset is requested takes longer
# system.time( isd(usaf="782680", wban="99999", year=2011) )
# system.time( isd(usaf="782680", wban="99999", year=2011) )
#
# # Optionally pass in curl options
# res <- isd(usaf="011490", wban="99999", year=1986, config = verbose())
#
# # Plot data
# ## get data for multiple stations
# res1 <- isd(usaf="011690", wban="99999", year=1993)
# res2 <- isd(usaf="172007", wban="99999", year=2015)
# res3 <- isd(usaf="702700", wban="00489", year=2015)
# res4 <- isd(usaf="109711", wban=99999, year=1970)
# ## combine data
# ### uses rbind.isd (all inputs of which must be of class isd)
# res_all <- rbind(res1, res2, res3, res4)
# # add date time
# library("lubridate")
# res_all$date_time <- ymd_hm(
# sprintf("%s %s", as.character(res_all$date), res_all$time)
# )
# ## remove 999's
# library("dplyr")
# res_all <- res_all %>% filter(temperature < 900)
# ## plot
# library("ggplot2")
# ggplot(res_all, aes(date_time, temperature)) +
# geom_line() +
# facet_wrap(~usaf_station, scales = "free_x")
# ## End(Not run)
Run the code above in your browser using DataLab