aqs_transactionsample_by_state: aqs_transactionsample_by_state

View source: R/bystate.R

aqs_transactionsample_by_stateR Documentation

aqs_transactionsample_by_state

Description

\lifecycle

stable Returns transactionsample data - aggregated by state in the AQS Submission Transaction Format (RD) sample (raw) data for a parameter code aggregated by matching input parameter, and stateFIPS provided for bdate - edate time frame. Includes data both in submitted and standard units

Usage

aqs_transactionsample_by_state(
  parameter,
  bdate,
  edate,
  stateFIPS,
  return_header = FALSE
)

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.

stateFIPS

a R character object which represents the 2 digit state FIPS code (with leading zero) for the state being requested. @seealso aqs_states() for the list of available FIPS codes.

return_header

If FALSE (default) only returns data requested. If TRUE returns a AQSAPI_v2 object which is a two item list that contains header information returned from the API server mostly used for debugging purposes in addition to the data requested.

Value

a tibble or an AQS_Data Mart_APIv2 S3 object of transaction sample (raw) data in the AQS submission transaction format (RD) corresponding to the inputs provided.

Note

The AQS API only allows for a single year of transaction data to be retrieved at a time. This function conveniently extracts date information from the bdate and edate parameters then makes repeated calls to the AQSAPI retrieving a maximum of one calendar year of data at a time. Each calendar year of data requires a separate API call so multiple years of data will require multiple API calls. As the number of years of data being requested increases so does the length of time that it will take to retrieve results. There is also a 5 second wait time inserted between successive API calls to prevent overloading the API server. This operation has a linear run time of /(Big O notation: O/(n + 5 seconds/)/).

See Also

Other Aggregate _by_state functions: aqs_qa_annualperformanceeval_by_state(), aqs_qa_annualperformanceevaltransaction_by_state(), aqs_quarterlysummary_by_box(), aqs_quarterlysummary_by_cbsa(), aqs_quarterlysummary_by_state(), aqs_transactionsample_by_MA()

Examples

#Returns a AQS_Data Mart_APIv2 S3 object of
         ## Not run:  # Returns a tibble containing benzene transaction sample
                   # data for North Carolina on May 15, 1995
                   aqs_transactionsample_by_state(parameter = "45201",
                                                 bdate = as.Date("19950515",
                                                         format = "%Y%m%d"),
                                                 edate = as.Date("19950515",
                                                          format = "%Y%m%d"),
                                                 stateFIPS = "37"
                                                 )
                 
## End(Not run)

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