MyNixOS website logo
Description

Access Air Quality Data from the 'OpenAQ' API.

Provides an interface to the 'OpenAQ' API <https://openaq.org/>, a platform for real-time and historical air quality data from around the world. Users can retrieve measurement data, metadata for sensors and locations for air quality research and monitoring.

openaq R client openaq hex logo

Project Status: Active – The project has reached a stable, usable state and is being actively developed. R-CMD-check Codecov test coverage

An R package for interacting with the OpenAQ API.

Installation

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")

Quickstart

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.

  1. Register for an account at https://explore.openaq.org/register.
  2. Find your API key in the user account page.
  3. Save your API key as the OPENAQ_API_KEYenvironment 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:

idnameis_mobileis_monitortimezonecountries_idcountry_namecountry_isolatitudelongitudedatetime_firstdatetime_lastowner_nameproviders_idprovider_name
41726AntananarivoFALSETRUEIndian/Antananarivo182MadagascarMG-18.9084847.537512020-12-22 07:00:002025-01-17 20:00:00Unknown Governmental Organization119AirNow

Development

Contributions are welcome. See the Development Guide for setup, building, testing, and code style. See the Contribution Guide for general contribution guidelines.

Metadata

Version

1.0.0

License

Unknown

Platforms (80)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows