aqs_services_by_cbsa: aqs_services_by_cbsa

View source: R/AQSAPI_helperfunctions.R

aqs_services_by_cbsaR Documentation

aqs_services_by_cbsa

Description

a helper function that abstracts the formatting of the inputs for a call to aqs away from the calling function for aggregations by cbsa then calls the aqs and returns the result. This helper function is not meant to be called directly from external functions.

Usage

aqs_services_by_cbsa(
  parameter,
  bdate,
  edate,
  cbsa_code,
  duration = NA_character_,
  service,
  cbdate = NA_Date_,
  cedate = NA_Date_,
  AQS_domain = "aqs.epa.gov"
)

Arguments

parameter

a character list or a single character string which represents the parameter code of the air pollutant related to the data being requested.

bdate

a R date object which represents that begin date of the data selection. Only data on or after this date will be returned.

edate

a R date object which represents that end date of the data selection. Only data on or before this date will be returned.

cbsa_code

a R character object which represents the 5 digit AQS Core Based Statistical Area code (the same as the census code, with leading zeros)

duration

an optional R character string that represents the parameter duration code that limits returned data to a specific sample duration. The default value of NA_character_ results in no filtering based on duration code.Valid durations include actual sample durations and not calculated durations such as 8 hour CO or $O_3$ rolling averages, 3/6 day PM averages or Pb 3 month rolling averages. @seealso aqs_sampledurations() for a list of all available duration codes.

service

a string which represents the services provided by the AQS API For a list of available services @seealso https://aqs.epa.gov/aqsweb/documents/data_api.html#services

cbdate

a R date object which represents a "beginning date of last change" that indicates when the data was last updated. cbdate is used to filter data based on the change date. Only data that changed on or after this date will be returned. This is an optional variable which defaults to NA_Date_.

cedate

a R date object which represents an "end date of last change" that indicates when the data was last updated. cedate is used to filter data based on the change date. Only data that changed on or before this date will be returned. This is an optional variable which defaults to NA_Date_.

AQS_domain

a R string object containing the domain that should be used in constructing the API call.

Value

a AQS_DATAMART_APIv2 S3 object that is the return value from the AQS API. A AQS_DATAMART_APIv2 is a 2 item named list in which the first item ($Header) is a tibble of header information from the AQS API and the second item ($Data) is a tibble of the data returned.


USEPA/RAQSAPI documentation built on Jan. 18, 2024, 1:50 a.m.