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:
timezone -- olson timezone
countryCode -- ISO 3166-1 alpha-2
stateCode -- ISO 3166-2 alpha-2
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.
pas_createNew( countryCodes = NULL, includePWFSL = TRUE, lookbackDays = 1, baseUrl = "https://www.purpleair.com/json" )
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
|
baseUrl | Base URL for synoptic data. |
A PurpleAir Synoptic pas object.
#> Error: parse error: object key and value must be separated by a colon (':') #> 602609450,"Hidden":"false","","LastSeen":1602609450,"Hidden" #> (right here) ------^