
An R package for interacting with the OpenAQ API.
The package is available to install through Github. Use the
pkg_install command from pak package.
install.packages("pak")
pak::pkg_install("openaq/openaq-r@*release")For a full walkthrough on using openaq we recommend that you read
through the “Introduction
to openaq” vignette (vignette("openaq")). The following
guide is a quick and minimal example to get you started.
OPENAQ_API_KEY environment
variable . e.g. OPENAQ_API_KEY=yourkey in
.Renviron. See help(openaq) for other ways to
use and access your API key.Now we can query OpenAQ for air quality monitoring locations. For this example we will query locations that measure PM2.5 near (with 10km) Antananarivo, Madagascar (-18.90848, 47.53751)
library(openaq)
locations <- list_locations(
parameters_id = 2,
coordinates = c(latitude = -18.90848, longitude = 47.53751),
radius = 10000
)This returns a data frame that will look something like:
| id | name | is_mobile | is_monitor | timezone | countries_id | country_name | country_iso | latitude | longitude | datetime_first | datetime_last | owner_name | providers_id | provider_name |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 41726 | Antananarivo | FALSE | TRUE | Indian/Antananarivo | 182 | Madagascar | MG | -18.90848 | 47.53751 | 2020-12-22 07:00:00 | 2025-01-17 20:00:00 | Unknown Governmental Organization | 119 | AirNow |
Contributions are welcome. See the Development Guide for setup, building, testing, and code style. See the Contribution Guide for general contribution guidelines.
Need a high-speed mirror for your open-source project?
Contact our mirror admin team at info@clientvps.com.
This archive is provided as a free public service to the community.
Proudly supported by infrastructure from VPSPulse , RxServers , BuyNumber , UnitVPS , OffshoreName and secure payment technology by ArionPay.