pas_createNew: Load latest PurpleAir synoptic data

Description Usage Arguments Value See Also Examples

View source: R/pas_createNew.R

Description

Download, parse and enhance synoptic data from PurpleAir and return the results as a useful tibble with class pa_synoptic.

Steps include:

1) Download and parse synoptic data

2) Replace variable with more consistent, more human readable names.

3) Add spatial metadata for each sensor including:

4) Convert data types from character to POSIXct and numeric.

5) Add distance and monitorID for the closest PWFSL monitor

Filtering by country may be performed by specifying the countryCodes argument.

Usage

1
2
3
4
5
6
pas_createNew(
  countryCodes = NULL,
  includePWFSL = TRUE,
  lookbackDays = 1,
  baseUrl = "https://www.purpleair.com/json?all=true"
)

Arguments

countryCodes

ISO country codes used to subset the data.

includePWFSL

Logical specifying whether to calculate distances from PWFSL monitors.

lookbackDays

Number of days to "look back" for valid data. Data are filtered to only include sensors with data more recent than lookbackDays ago.

baseUrl

Base URL for synoptic data.

Value

A PurpleAir Synoptic pas object.

See Also

pas_load

pas_downloadParseRawData

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(AirSensor)

initializeMazamaSpatialUtils()

pas <- pas_createNew("US")

if ( interactive() ) {
  pas %>% 
    pas_filter(stateCode == "CA") %>%
    pas_leaflet()
}

AirSensor documentation built on March 13, 2021, 1:07 a.m.