pas_load: Load PurpleAir synoptic data

Description Usage Arguments Value See Also Examples

View source: R/pas_load.R

Description

A pre-generated pa_synoptic object will be loaded for the given date. These files are generated each day and provide a record of all currently installed PurpleAir sensors for the day of interest. With default arguments, this function will always load data associated with the most recent pre-generated file – typically less than one hour old.

The datestamp can be anything that is understood by lubrdiate::ymd() including either of the following recommended formats:

By default, the host computer's date is used.

The pas object for a specific hour may be loaded by specifying datestamp = "YYYYmmddHH".

Usage

1
2
3
4
5
6
7
pas_load(
  datestamp = NULL,
  retries = 30,
  timezone = "America/Los_Angeles",
  archival = FALSE,
  verbose = TRUE
)

Arguments

datestamp

Local date string in valid YYYY-mm-dd format. See description.

retries

Max number of days to go back and try to load if requested date cannot be retrieved.

timezone

Timezone used to interpret datestamp.

archival

Logical specifying whether a version should be loaded that includes sensors that have stopped reporting.

verbose

Logical controlling the generation of warning and error messages.

Value

A PurpleAir Synoptic pas object.

See Also

pas_createNew

Examples

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

setArchiveBaseUrl("http://data.mazamascience.com/PurpleAir/v1")

pas <- pas_load()

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

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