| Title: | Access Air Quality Data from the 'OpenAQ' API |
|---|---|
| Description: | 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. |
| Authors: | Russ Biggs [aut, cre] (ORCID: <https://orcid.org/0009-0008-0777-8479>), Christian Parker [aut], Francesca Mills [ctb], OpenAQ [cph, fnd] |
| Maintainer: | Russ Biggs <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.0 |
| Built: | 2026-05-20 05:52:01 UTC |
| Source: | https://github.com/openaq/openaq-r |
Method for converting openaq_countries_list to data frame.
## S3 method for class 'openaq_countries_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)## S3 method for class 'openaq_countries_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
x |
A list of countries as returned from list_countries. |
row.names |
|
optional |
logical. If TRUE, setting row names and converting column names (to syntactic names: see make.names) is optional. Note that all of R's base package as.data.frame() methods use optional only for column names treatment, basically with the meaning of data.frame(*, check.names = !optional). See also the make.names argument of the matrix method. |
... |
additional arguments to be passed to or from methods. |
A data frame class of the countries results, with the following columns:
Numeric. The countries identifier
Character. Then English name of the country.
Character. The ISO-3166 Alpha 2 identifier for the country.
POSIXct. The datetime of the first measurement value available in the country.
POSIXct. The datetime of the last measurement value available in the country.
Character. A comma delimited list of parameter ids that are measured within the country.
Character. a comma delimited list of parameter names and their units that are measured within the country.
The data frame also includes a meta attribute from the original
openaq_countries_list.
countries <- list_countries(as_data_frame = FALSE) as.data.frame(countries)countries <- list_countries(as_data_frame = FALSE) as.data.frame(countries)
Method for converting openaq_instruments_list to data frame.
## S3 method for class 'openaq_instruments_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)## S3 method for class 'openaq_instruments_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
x |
A list of instruments as returned from list_instruments. |
row.names |
|
optional |
logical. If TRUE, setting row names and converting column names (to syntactic names: see make.names) is optional. Note that all of R's base package as.data.frame() methods use optional only for column names treatment, basically with the meaning of data.frame(*, check.names = !optional). See also the make.names argument of the matrix method. |
... |
additional arguments to be passed to or from methods. |
A data frame class of the instruments results, with the following columns:
Numeric. The instruments identifier.
Character. The name of the measurement instrument.
Logical. Indicates if the instrument is considered a reference monitor.
Numeric. The manufacturers identifier for the manufacturer that makes the instrument.
Factor. The name of manufacturer that makes the instrument.
The data frame also includes a meta attribute from the original
openaq_instruments_list.
instruments <- list_instruments(as_data_frame = FALSE) as.data.frame(instruments)instruments <- list_instruments(as_data_frame = FALSE) as.data.frame(instruments)
Method for converting openaq_latest_list to data frame.
## S3 method for class 'openaq_latest_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)## S3 method for class 'openaq_latest_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
x |
A list of latest measurements as returned from list_location_latest or list_parameter_latest. |
row.names |
|
optional |
logical. If TRUE, setting row names and converting column names (to syntactic names: see make.names) is optional. Note that all of R's base package as.data.frame() methods use optional only for column names treatment, basically with the meaning of data.frame(*, check.names = !optional). See also the make.names argument of the matrix method. |
... |
additional arguments to be passed to or from methods. |
A data frame class of the latest results, with the following columns:
Numeric. The sensors identifier.
Numeric. The locations identifier.
Numeric. The measurement value.
POSIXct. The datetime of the measurement value, in local time
POSIXct. The datetime of the measurement value, in UTC time
Numeric. The latitude, geographic Y, value for the measurement.
Numeric. The longitude, geographic X, value for the measurement.
The data frame also includes a meta attribute from the original
openaq_latest_list.
latest <- list_location_latest(2178, as_data_frame = FALSE) as.data.frame(latest)latest <- list_location_latest(2178, as_data_frame = FALSE) as.data.frame(latest)
Method for converting openaq_licenses_list to data frame.
## S3 method for class 'openaq_licenses_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)## S3 method for class 'openaq_licenses_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
x |
A list of licenses as returned from list_licenses. |
row.names |
|
optional |
logical. If TRUE, setting row names and converting column names (to syntactic names: see make.names) is optional. Note that all of R's base package as.data.frame() methods use optional only for column names treatment, basically with the meaning of data.frame(*, check.names = !optional). See also the make.names argument of the matrix method. |
... |
additional arguments to be passed to or from methods. |
A data frame class of the licenses results, with the following columns:
Numeric. The licenses identifier.
Character. The license name.
Logical. Indicates whether commerical use is allowed under the license terms.
Logical. Indicates whether attribution is required under the license terms.
Logical. Indicates whether share-alike is required under the license terms.
Logical. Indicates whether modification is allowed under the license terms.
Logical. Indicates whether redistribution is allowed under the license terms.
String. The URL of the license as listed by the upstream source.
The data frame also includes a meta attribute from the original
openaq_licenses_list.
licenses <- list_licenses(as_data_frame = FALSE) as.data.frame(licenses)licenses <- list_licenses(as_data_frame = FALSE) as.data.frame(licenses)
Method for converting openaq_locations_list to data frame.
## S3 method for class 'openaq_locations_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)## S3 method for class 'openaq_locations_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
x |
A list of locations as returned from list_locations. |
row.names |
|
optional |
logical. If TRUE, setting row names and converting column names (to syntactic names: see make.names) is optional. Note that all of R's base package as.data.frame() methods use optional only for column names treatment, basically with the meaning of data.frame(*, check.names = !optional). See also the make.names argument of the matrix method. |
... |
additional arguments to be passed to or from methods. |
A data frame class of the locations results, with the following columns:
Numeric. The locations identifier.
Character. The name of the location.
Logical. Indicates whether the location is stationary or mobile.
Logical. Indicates whether the location is considered a reference monitor.
Factor. The IANA timezone of the location (e.g. "America/New_York").
Numeric. The countries identifier where the location is located.
Character. The name of the country where the location is located
Factor. The ISO 3166-1 alpha-2 country code where the location is located
Numeric.The latitude, geographic Y, value for the measurement.
Numeric. The longitude, geographic X, value for the measurement.
POSIXct. The datetime of the first measurement of this location.
POSIXct. The datetime of the last measurement of this location.
Factor. The name of the owner of the location.
Numeric. The providers identifier for the location.
Character. The name of the provider for the location.
The data frame also includes a meta attribute from the original
openaq_locations_list.
loc <- list_locations(as_data_frame = FALSE) as.data.frame(loc)loc <- list_locations(as_data_frame = FALSE) as.data.frame(loc)
Method for converting openaq_manufacturers_list to data frame.
## S3 method for class 'openaq_manufacturers_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)## S3 method for class 'openaq_manufacturers_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
x |
A list of manufacturers as returned from list_manufacturers. |
row.names |
|
optional |
logical. If TRUE, setting row names and converting column names (to syntactic names: see make.names) is optional. Note that all of R's base package as.data.frame() methods use optional only for column names treatment, basically with the meaning of data.frame(*, check.names = !optional). See also the make.names argument of the matrix method. |
... |
additional arguments to be passed to or from methods. |
A data frame class of the manufacturers results, with the following columns:
Numeric. The manufacturers identifier.
Character. The name of the manufacturer.
Character. A comma delimited list of instrument identifiers manufactured by the manufacturer.
Character. A comma delimited list of instrument names manufactured by this manufacturer.
The data frame also includes a meta attribute from the original
openaq_manufacturers_list.
manufacturers <- list_manufacturers(as_data_frame = FALSE) as.data.frame(manufacturers)manufacturers <- list_manufacturers(as_data_frame = FALSE) as.data.frame(manufacturers)
Method for converting openaq_measurements_list to data frame.
## S3 method for class 'openaq_measurements_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)## S3 method for class 'openaq_measurements_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
x |
A list of measurements as returned from list_sensor_measurements. |
row.names |
|
optional |
logical. If TRUE, setting row names and converting column names (to syntactic names: see make.names) is optional. Note that all of R's base package as.data.frame() methods use optional only for column names treatment, basically with the meaning of data.frame(*, check.names = !optional). See also the make.names argument of the matrix method. |
... |
additional arguments to be passed to or from methods. |
A data frame class of the measurements results, with the following columns:
Numeric. The measurement value.
Numeric. The parameter identifier for the measurement.
Character. The name of the measured parameter.
Character. The units of the measured parameter.
Factor. The label describing the measurement period (e.g. "hour", "day").
Factor. The period of the measurement interval in HH:MM:SS format (e.g. "01:00:00").
POSIXct. The start datetime of the measurement period in local time.
POSIXct. The end datetime of the measurement period in local time.
Numeric. The latitude, geographic Y, value for the measurement.
Numeric. The longitude, geographic X, value for the measurement.
Numeric. The minimum value within the measurement period.
Numeric. The 2nd percentile value within the measurement period.
Numeric. The 25th percentile value within the measurement period.
Numeric. The median value within the measurement period.
Numeric. The 75th percentile value within the measurement period.
Numeric. The 98th percentile value within the measurement period.
Numeric. The maximum value within the measurement period.
Numeric. The average value within the measurement period.
Numeric. The standard deviation of values within the measurement period.
Numeric. The expected number of measurements within the period.
Factor. The expected measurement interval in HH:MM:SS format (e.g. "01:00:00").
Numeric. The observed number of measurements within the period.
Factor. The observer measurement interval in HH:MM:SS format (e.g. "01:00:00").
Numeric. The percentage of expected measurements that were observed.
Numeric. The percentage of time coverage for the measurement period.
The data frame also includes a meta attribute from the original
openaq_measurements_list.
meas <- list_sensor_measurements(23707, limit = 500, as_data_frame = FALSE) as.data.frame(meas)meas <- list_sensor_measurements(23707, limit = 500, as_data_frame = FALSE) as.data.frame(meas)
Method for converting openaq_owners_list to data frame.
## S3 method for class 'openaq_owners_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)## S3 method for class 'openaq_owners_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
x |
A list of owners as returned from list_owners. |
row.names |
|
optional |
logical. If TRUE, setting row names and converting column names (to syntactic names: see make.names) is optional. Note that all of R's base package as.data.frame() methods use optional only for column names treatment, basically with the meaning of data.frame(*, check.names = !optional). See also the make.names argument of the matrix method. |
... |
additional arguments to be passed to or from methods. |
A data frame class of the owners results, with the following columns:
Numeric. The owners identifier.
Character. The owners name.
The data frame also includes a meta attribute from the original
openaq_owners_list.
owners <- list_owners(as_data_frame = FALSE) as.data.frame(owners)owners <- list_owners(as_data_frame = FALSE) as.data.frame(owners)
Method for converting openaq_parameters_list to data frame.
## S3 method for class 'openaq_parameters_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)## S3 method for class 'openaq_parameters_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
x |
A list of parameters as returned from list_parameters. |
row.names |
|
optional |
logical. If TRUE, setting row names and converting column names (to syntactic names: see make.names) is optional. Note that all of R's base package as.data.frame() methods use optional only for column names treatment, basically with the meaning of data.frame(*, check.names = !optional). See also the make.names argument of the matrix method. |
... |
additional arguments to be passed to or from methods. |
A data frame class of the parameters results, with the following columns:
Numeric. The parameter identifier.
Character. Name of the parameter.
Character. The units used by the parameter.
Character. The combined name of the parameter and units. May be NA if not provided.
Character. Description of the parameter. May be NA if not provided.
The data frame also includes a meta attribute from the original
openaq_parameters_list.
parameters <- list_parameters(as_data_frame = FALSE) as.data.frame(parameters)parameters <- list_parameters(as_data_frame = FALSE) as.data.frame(parameters)
Method for converting openaq_providers_list to data frame.
## S3 method for class 'openaq_providers_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)## S3 method for class 'openaq_providers_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
x |
A list of providers as returned from list_providers. |
row.names |
|
optional |
logical. If TRUE, setting row names and converting column names (to syntactic names: see make.names) is optional. Note that all of R's base package as.data.frame() methods use optional only for column names treatment, basically with the meaning of data.frame(*, check.names = !optional). See also the make.names argument of the matrix method. |
... |
additional arguments to be passed to or from methods. |
A data frame class of the providers results, with the following columns:
Numeric. The providers identifier.
Character. The name of the provider.
Factor. The name of the source.
Character. Prefixed when exported to file store.
POSIXct. Datetime when the provider was first added to OpenAQ.
POSIXct. Datetime of the first measurement value from the provider.
POSIXct. Datetime of the last measurement value from the provider.
Numeric. Entities identifier for the provider.
Character. A comma delimited list of parameters identifier measured by the provider.
The data frame also includes a meta attribute from the original
openaq_providers_list.
providers <- list_providers(as_data_frame = FALSE) as.data.frame(providers)providers <- list_providers(as_data_frame = FALSE) as.data.frame(providers)
Method for converting openaq_sensors_list to data frame.
## S3 method for class 'openaq_sensors_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)## S3 method for class 'openaq_sensors_list' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
x |
A list of sensors as returned from get_sensor or list_location_sensors. |
row.names |
|
optional |
logical. If TRUE, setting row names and converting column names (to syntactic names: see make.names) is optional. Note that all of R's base package as.data.frame() methods use optional only for column names treatment, basically with the meaning of data.frame(*, check.names = !optional). See also the make.names argument of the matrix method. |
... |
additional arguments to be passed to or from methods. |
A data frame class of the sensors results, with the following columns:
Numeric. The sensors identifier.
Character.
Numeric. .
POSIXct. The datetime of the first measurement in UTC.
POSIXct. The datetime of the first measurement in local time.
POSIXct. The datetime of the last measurement in UTC.
POSIXct. The datetime of the last measurement in local time.
Numeric. The minimum measurement value recorded by the sensor.
Numeric. The maximum measurement value recorded by the sensor.
Numeric. The average measurement value recorded by the sensor.
Numeric. The expected number of measurements for the sensor.
Factor. The expected measurement interval in HH:MM:SS format (e.g. "01:00:00").
Numeric. The observed number of measurements for the sensor.
Factor. The observed measurement interval in HH:MM:SS format (e.g. "01:00:00").
Numeric. The percentage of expected measurements that were observed.
Numeric. The percentage of time coverage for the sensor.
Numeric. The most recent measurement value from the sensor.
POSIXct. The datetime of the most recent measurement.
Numeric. The latitude of the most recent measurement location.
Numeric. The longitude of the most recent measurement location
The data frame also includes a meta attribute from the original
openaq_sensors_list.
sensor <- get_sensor(42, as_data_frame = FALSE) as.data.frame(sensor)sensor <- get_sensor(42, as_data_frame = FALSE) as.data.frame(sensor)
Toggles on the RATE_LIMIT environment variable to TRUE.
enable_rate_limit()enable_rate_limit()
No return value, called for side effects.
enable_rate_limit()enable_rate_limit()
Get a single country from countries resource.
get_country( countries_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )get_country( countries_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
countries_id |
An integer representing the OpenAQ countries_id. |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or list of the results.
country <- get_country(42)country <- get_country(42)
Get a single instrument from the instruments resource.
get_instrument( instruments_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )get_instrument( instruments_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
instruments_id |
An integer representing the OpenAQ instruments_id. |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or a list of the results.
instrument <- get_instrument(42)instrument <- get_instrument(42)
Get a single license from the licenses resource.
get_license( licenses_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )get_license( licenses_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
licenses_id |
An integer representing the OpenAQ licenses_id. |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or a list of the results.
license <- get_license(42)license <- get_license(42)
Get a single location from the locations resource.
get_location( locations_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )get_location( locations_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
locations_id |
An integer representing the locations_id to request. |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or list of results.
location <- get_location(42)location <- get_location(42)
Get a single manufacturer from the manufacturers resource.
get_manufacturer( manufacturers_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )get_manufacturer( manufacturers_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
manufacturers_id |
An integer representing the OpenAQ manufacturers_id. |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or a list of the results.
manufacturer <- get_manufacturer(42)manufacturer <- get_manufacturer(42)
Get a single owner from owners resource.
get_owner( owners_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )get_owner( owners_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
owners_id |
An integer representing the OpenAQ owners_id. |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or a list of the results.
owners <- get_owner(42)owners <- get_owner(42)
Get a single parameter from the parameters resource.
get_parameter( parameters_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )get_parameter( parameters_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
parameters_id |
An integer representing the OpenAQ parameters_id. |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or a list of the results.
parameter <- get_parameter(42)parameter <- get_parameter(42)
Get a single provider from providers resource.
get_provider( providers_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )get_provider( providers_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
providers_id |
An integer representing the OpenAQ providers_id. |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or a list of the results.
provider <- get_provider(42)provider <- get_provider(42)
Get a single sensor from sensors resource.
get_sensor( sensors_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )get_sensor( sensors_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
sensors_id |
An integer representing the OpenAQ sensors_id. |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or a list of the results.
sensor <- get_sensor(42)sensor <- get_sensor(42)
Get a list of countries from the countries resource.
list_countries( providers_id = NULL, parameters_id = NULL, order_by = NULL, sort_order = NULL, limit = NULL, page = NULL, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )list_countries( providers_id = NULL, parameters_id = NULL, order_by = NULL, sort_order = NULL, limit = NULL, page = NULL, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
providers_id |
A numeric vector of length 1 or more, containing the ID(s) of the providers to use for filtering results. If multiple IDs are provided, results matching any of the IDs will be returned. |
parameters_id |
A numeric vector of length 1 or more, containing the ID(s) of the parameters to use for filtering results. If multiple IDs are provided, results matching any of the IDs will be returned. |
order_by |
A character string specifying the field to order results by. |
sort_order |
A character string specifying sort direction, either |
limit |
An integer specifying the maximum number of results to return, default is |
page |
An integer specifying the page number for paginated results, default is |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or a list of the results.
countries <- list_countries()countries <- list_countries()
Get a list of instruments from the instruments resource.
list_instruments( order_by = NULL, sort_order = NULL, limit = NULL, page = NULL, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )list_instruments( order_by = NULL, sort_order = NULL, limit = NULL, page = NULL, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
order_by |
A character string specifying the field to order results by. |
sort_order |
A character string specifying sort direction, either |
limit |
An integer specifying the maximum number of results to return, default is |
page |
An integer specifying the page number for paginated results, default is |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or a list of the results.
instruments <- list_instruments()instruments <- list_instruments()
Get a list of licenses from the licenses resource.
list_licenses( order_by = NULL, sort_order = NULL, limit = NULL, page = NULL, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )list_licenses( order_by = NULL, sort_order = NULL, limit = NULL, page = NULL, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
order_by |
A character string specifying the field to order results by. |
sort_order |
A character string specifying sort direction, either |
limit |
An integer specifying the maximum number of results to return, default is |
page |
An integer specifying the page number for paginated results, default is |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or a list of the results.
licenses <- list_licenses()licenses <- list_licenses()
Get the latest measurements by locations_id.
list_location_latest( locations_id, datetime_min = NULL, limit = NULL, page = NULL, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )list_location_latest( locations_id, datetime_min = NULL, limit = NULL, page = NULL, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
locations_id |
An integer representing the OpenAQ locations_id. |
datetime_min |
A POSIXct datetime specifying the minimum datetime for
filtering results, default is |
limit |
An integer specifying the maximum number of results to return,
default is |
page |
An integer specifying the page number for paginated results,
default is |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or a list of the results.
measurements <- list_location_latest(2178)measurements <- list_location_latest(2178)
Get a list of a location's sensors.
list_location_sensors( locations_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )list_location_sensors( locations_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
locations_id |
An integer representing the OpenAQ locations_id. |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or a list of the results.
sensors <- list_location_sensors(42)sensors <- list_location_sensors(42)
Get a list of locations from the locations resource.
list_locations( bbox = NULL, coordinates = NULL, radius = NULL, providers_id = NULL, parameters_id = NULL, owner_contacts_id = NULL, manufacturers_id = NULL, licenses_id = NULL, monitor = NULL, mobile = NULL, instruments_id = NULL, iso = NULL, countries_id = NULL, order_by = NULL, sort_order = NULL, limit = NULL, page = NULL, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )list_locations( bbox = NULL, coordinates = NULL, radius = NULL, providers_id = NULL, parameters_id = NULL, owner_contacts_id = NULL, manufacturers_id = NULL, licenses_id = NULL, monitor = NULL, mobile = NULL, instruments_id = NULL, iso = NULL, countries_id = NULL, order_by = NULL, sort_order = NULL, limit = NULL, page = NULL, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
bbox |
Named numeric vector with four coordinates in form X minimum,
Y minimum, X maximum, Y maximum, named values must be |
coordinates |
Named numeric vector with two numeric WGS84 (EPSG:4326)
geographic coordinates, with named values |
radius |
An integer for the number of meters to search around the
|
providers_id |
A numeric vector of length 1 or more, containing the
ID(s) of the provider(s) to use for filtering results. If multiple IDs are
provided, results matching any of the IDs will be returned. default is
|
parameters_id |
A numeric vector of length 1 or more, containing the
ID(s) of the parameter(s) to use for filtering results. If multiple IDs are
provided, results matching any of the IDs will be returned. default is
|
owner_contacts_id |
A numeric vector of length 1 or more, containing the
ID(s) of the owners(s) to use for filtering results. If multiple IDs are
provided, results matching any of the IDs will be returned. default is
|
manufacturers_id |
A numeric vector of length 1 or more, containing the
ID(s) of the manufacturers(s) to use for filtering results. If multiple IDs
are provided, results matching any of the IDs will be returned. default is
|
licenses_id |
A numeric vector of length 1 or more, containing the
ID(s) of the license(s) to use for filtering results. If multiple IDs are
provided, results matching any of the IDs will be returned. default is
|
monitor |
A logical to filter results to regulatory monitors (TRUE) or
air sensors (FALSE), both are included if NULL, default is |
mobile |
A logical to filter results to mobile (TRUE) or stationary
(FALSE) location, both are included if NULL, default is |
instruments_id |
A numeric vector of length 1 or more, containing the
ID(s) of the instrument(s) to use for filtering results. If multiple IDs are
provided, results matching any of the IDs will be returned. default is
|
iso |
An ISO 3166-1 alpha-2 string of the country to filter the results, , default is |
countries_id |
A numeric vector of length 1 or more containing country
IDs to use for filtering results. If multiple IDs are
provided, results matching any of the IDs will be returned. default is
|
order_by |
A character string specifying the field to order results by. |
sort_order |
A character string specifying sort direction, either |
limit |
An integer specifying the maximum number of results to return, default is |
page |
An integer specifying the page number for paginated results, default is |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers. default is |
api_key |
A valid OpenAQ API key string. default is |
A data frame or list of results.
locations <- list_locations()locations <- list_locations()
Get a list of manufacturer instruments from the instruments resource.
list_manufacturer_instruments( manufacturers_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )list_manufacturer_instruments( manufacturers_id, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
manufacturers_id |
An integer representing the OpenAQ manufacturers_id. |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or a list of the results.
instruments <- list_manufacturer_instruments(42)instruments <- list_manufacturer_instruments(42)
Get a list of manufacturers from the manufacturers resource.
list_manufacturers( order_by = NULL, sort_order = NULL, limit = NULL, page = NULL, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )list_manufacturers( order_by = NULL, sort_order = NULL, limit = NULL, page = NULL, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
order_by |
A character string specifying the field to order results by. |
sort_order |
A character string specifying sort direction, either |
limit |
An integer specifying the maximum number of results to return, default is |
page |
An integer specifying the page number for paginated results, default is |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or a list of the results.
manufacturers <- list_manufacturers()manufacturers <- list_manufacturers()
Get a list of owners from the owners resource.
list_owners( order_by = NULL, sort_order = NULL, limit = NULL, page = NULL, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )list_owners( order_by = NULL, sort_order = NULL, limit = NULL, page = NULL, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
order_by |
A character string specifying the field to order results by. |
sort_order |
A character string specifying sort direction, either |
limit |
An integer specifying the maximum number of results to return, default is |
page |
An integer specifying the page number for paginated results, default is |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or a list of the results.
owners <- list_owners()owners <- list_owners()
Get the latest measurements by parameters_id.
list_parameter_latest( parameters_id, datetime_min = NULL, limit = NULL, page = NULL, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )list_parameter_latest( parameters_id, datetime_min = NULL, limit = NULL, page = NULL, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
parameters_id |
An integer representing the OpenAQ parameters_id |
datetime_min |
A POSIXct datetime specifying the minimum datetime for
filtering results, default is |
limit |
An integer specifying the maximum number of results to return,
default is |
page |
An integer specifying the page number for paginated results,
default is |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or a list of the results.
measurements <- list_parameter_latest(2)measurements <- list_parameter_latest(2)
Get a list of parameters from the parameters resource.
list_parameters( order_by = NULL, sort_order = NULL, limit = 100, page = 1, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )list_parameters( order_by = NULL, sort_order = NULL, limit = 100, page = 1, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
order_by |
A character string specifying the field to order results by. |
sort_order |
A character string specifying sort direction, either |
limit |
An integer specifying the maximum number of results to return, default is |
page |
An integer specifying the page number for paginated results, default is |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or a list of the results.
parameters <- list_parameters()parameters <- list_parameters()
Get a list of providers from the providers resource.
list_providers( order_by = NULL, sort_order = NULL, limit = 100, page = 1, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )list_providers( order_by = NULL, sort_order = NULL, limit = 100, page = 1, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
order_by |
A character string specifying the field to order results by. |
sort_order |
A character string specifying sort direction, either |
limit |
An integer specifying the maximum number of results to return, default is |
page |
An integer specifying the page number for paginated results, default is |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or a list of the results.
providers <- list_providers()providers <- list_providers()
Get a list of measurements by sensors_id.
list_sensor_measurements( sensors_id, data = "measurements", rollup = NULL, datetime_from = NULL, datetime_to = NULL, order_by = NULL, sort_order = NULL, limit = NULL, page = NULL, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )list_sensor_measurements( sensors_id, data = "measurements", rollup = NULL, datetime_from = NULL, datetime_to = NULL, order_by = NULL, sort_order = NULL, limit = NULL, page = NULL, as_data_frame = TRUE, dry_run = FALSE, rate_limit = FALSE, api_key = NULL )
sensors_id |
An integer representing an OpenAQ sensors_id. |
data |
A character string for the data interval to return, default is "measurements". |
rollup |
A character string representing the aggregation rollup, default
is |
datetime_from |
A POSIXct datetime (when |
datetime_to |
A POSIXct datetime (when |
order_by |
A character string representing the field to order by,
default is |
sort_order |
A character string, either "asc" or "desc", default is
|
limit |
An integer representing the number of results per page. |
page |
An integer representing the page number. |
as_data_frame |
A logical for toggling whether to return results as
data frame or list, default is |
dry_run |
A logical for toggling a dry run of the request, default is
|
rate_limit |
A logical for toggling automatic rate limiting based on
rate limit headers, default is |
api_key |
A valid OpenAQ API key string, default is |
A data frame or a list of the results.
measurements <- list_sensor_measurements(3920, "hours")measurements <- list_sensor_measurements(3920, "hours")
Plots location coordinates. If the maps package is installed, a world
boundary overlay is added. Install with install.packages("maps").
## S3 method for class 'openaq_locations_data.frame' plot(x, y = NULL, ...)## S3 method for class 'openaq_locations_data.frame' plot(x, y = NULL, ...)
x |
the coordinates of points in the plot. Alternatively, a single plotting structure, function or any R object with a plot method can be provided. |
y |
the y coordinates of points in the plot, optional if x is an appropriate structure. |
... |
Other options passed on to base::plot(). |
Called for its side effect of producing a plot. Returns NULL
invisibly.
df <- list_locations(limit = 100) plot(df, pch = 19, col = df$provider_name)df <- list_locations(limit = 100) plot(df, pch = 19, col = df$provider_name)
Helper for plotting locations from list.
## S3 method for class 'openaq_locations_list' plot(x, y = NULL, ...)## S3 method for class 'openaq_locations_list' plot(x, y = NULL, ...)
x |
A list of locations results. |
y |
default is |
... |
Other options passed on to base::plot(). |
Called for its side effect of producing a plot. Returns NULL
invisibly.
loc <- list_locations(limit = 6, as_data_frame = FALSE) plot(loc, pch = 19, col = 2)loc <- list_locations(limit = 6, as_data_frame = FALSE) plot(loc, pch = 19, col = 2)
Helper for plotting measurements
## S3 method for class 'openaq_measurements_data.frame' plot(x, y = NULL, ...)## S3 method for class 'openaq_measurements_data.frame' plot(x, y = NULL, ...)
x |
A data frame of measurements results. |
y |
Unused, default is |
... |
Other options to be passed on to base::plot(). |
Called for its side effect of producing a plot. Returns NULL
invisibly.
meas <- list_sensor_measurements(23707, limit = 500, as_data_frame = FALSE) plot(meas)meas <- list_sensor_measurements(23707, limit = 500, as_data_frame = FALSE) plot(meas)
Helper for plotting measurements from list
## S3 method for class 'openaq_measurements_list' plot(x, y = NULL, ...)## S3 method for class 'openaq_measurements_list' plot(x, y = NULL, ...)
x |
A list of measurements results. |
y |
Other data |
... |
Other options to be passed on to base::plot(). |
Called for its side effect of producing a plot. Returns NULL
invisibly.
meas <- list_sensor_measurements(23707, limit = 500) plot(meas)meas <- list_sensor_measurements(23707, limit = 500) plot(meas)
A helper function to set the OPENAQ_API_KEY environment variable.
set_api_key(api_key)set_api_key(api_key)
api_key |
A character string value for the API key to set. |
No return value, called for side effects.
set_api_key("my-super-secret-openaq-api-key-1234")set_api_key("my-super-secret-openaq-api-key-1234")
A helper function to set the OPENAQR_BASE_URL environment variable. This is to override the default URL for testing and custom instance of the API. This function is generally not used by most users except in extraordinary cases.
set_base_url(base_url)set_base_url(base_url)
base_url |
A character string containing a URL. |
No return value, called for side effects.
set_base_url("https://example.com")set_base_url("https://example.com")