openaq_get_averages | R Documentation |
openaq_find_sites
, download daily
average PM2.5 data from the OpenAQ APIFor the sites found with openaq_find_sites
, download daily
average PM2.5 data from the OpenAQ API
openaq_get_averages(sites, date_from, date_to)
sites |
A data frame returned by |
date_from |
Earliest date to query in character format "YY-mm-dd" |
date_to |
Latest date to query in character format "YY-mm-dd" |
A data frame with daily avereage PM2.5
ca <- sf::st_read("states_hi_res.shp")
ca <- dplyr::filter(ca, STATE_NAME == "California")
ca <- dplyr::select(ca, OBJECTID, STATE_NAME)
proj_string <- "+proj=aea +lat_1=30 +lat_2=50 +lat_0=40 +lon_0=-125 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs "
ca_ea <- sf::st_transform(ca, crs = proj_string)
sites <- openaq_find_sites(ca_ea)
date_from <- "2021-02-01"
date_to <- "2021-02-28"
avgs <- openaq_get_averages(sites, date_from, date_to)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.