get_area_pas: Getting PurpleAir Sensors (PAS) by Area and Date

Description Usage Arguments Value See Also Examples

View source: R/get_area_pas.R

Description

Load the PAS within a specified area

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
get_area_pas(
  state_code = input_stateCode,
  west = input_west,
  east = input_east,
  south = input_south,
  north = input_north,
  labels = input_labels,
  datestamp = input_enddate,
  startdate = input_startdate,
  archive_url = "https://airsensor.aqmd.gov/PurpleAir/v1/"
)

Arguments

state_code

Character, optional. State of monitors to include. If NULL/unspecified, all monitors specified in the above boundaries will be included regardless of state.

west

Numeric; The western boundary coordinate

east

Numeric; The eastern boundary coordinate

south

Numeric; The southern boundary coordinate

north

Numeric; The northern boundary coordinate

labels

Character list, optional; Labels of monitors to include. If NULL/unspecified, all monitors will be included. The labels are based on string detection (str_detect), so for instance having "STAR" will pull all that have the word "STAR" in the label. Capitalization matters.

datestamp

Character; Important argument for loading historical data, as not all monitors might be actively reporting anymore. Format: "YYYY-MM-DD".

startdate

Character; Relevant for calculating lookback days (the maximum number of days to go back and try to load data if the requested date cannot be retrieved). Format: "YYYY-MM-DD".

archive_url

Character; see setArchiveBaseUrl. Known options include:

  • "https://airsensor.aqmd.gov/PurpleAir/v1/" (default) - The archive URL which works given that inputs are at least a few months prior to current date

  • "http://data.mazamascience.com/PurpleAir/v1" - The archive URL used when designing these functions, which has recently stopped working

Value

A dataframe returning all PAS within the defined area

See Also

pas_load()

Other PA API functions: get_area_pat(), get_ids(), wrangle_data()

Examples

1
2
3
get_area_pas("OR", -122.854, 45.4, -122.58, 45.6,
  c("se", "SE", "Se", "\\bSTAR\\b", "\\bPSU\\b"),
  datestamp = "2020-07-07", startdate = "2020-07-01")

gmcginnis/AirVizR documentation built on Dec. 20, 2021, 11:49 a.m.