Skip to contents

[Stable] Returns a table of collocated assessment data aggregated by matching input parameter, stateFIPS, county_code, and sitenum provided for bdate - edate time frame.

Usage

aqs_qa_collocated_assessments_by_site(
  parameter,
  bdate,
  edate,
  stateFIPS,
  countycode,
  sitenum,
  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 the begin date of the data selection. Only data on or after this date will be returned.

edate

a R date object which represents the 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. Use aqs_states() for the list of available FIPS codes.

countycode

a R character object which represents the 3 digit state FIPS code for the county being requested (with leading zero(s)). Use aqs_counties_by_state() for the list of available county codes in each state.

sitenum

a R character object which represents the 4 digit site number (with leading zeros) within the county and state being requested. Use aqs_sites_by_county() for the list of available site numbers in given county and state.

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_DataMart_APIv2 S3 object containing quality assurance collocated assessment data for monitors within a site. An 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.

Note

The AQS API only allows for a single year of collocated assessments 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 $mathcal(n + 5 seconds)$.

Examples

#returns a tibble of collocated assessment data
          #  for FRM PM2.5 at the Huntsville Old Airport site (\#0014)
          #  in Madison County, AL for January 2015:
 if (FALSE) aqs_qa_collocated_assessments_by_site(parameter = '88101',
                                                bdate = as.Date('20150101',
                                                            format = '%Y%m%d'
                                                               ),
                                                edate = as.Date('20150131',
                                                            format = '%Y%m%d'
                                                                ),
                                                stateFIPS = '01',
                                                countycode = '089',
                                                sitenum = '0014'
                                                )
          # \dontrun{}