Description Usage Arguments Details Value Note Examples
This function creates interactive maps that will be displayed in RStudio's 'Viewer' tab.
Typical usage would be to use the parameter
argument to display pm25
values from one of:
"pm25_current"
"pm25_10min"
"pm25_30min"
"pm25_1hr"
"pm25_6hr"
"pm25_1day"
"pm25_1week"
Auxiliary parameter
arguments can be used to display various Purple Air
sensor data. Currently supported parameter
arguments include:
"humidity"
"pressure"
"temperature"
"pwfsl_closestDistance"
1 2 3 4 5 6 7 8 9 | pas_leaflet(
pas = NULL,
parameter = "pm25_1hr",
paletteName = NULL,
radius = 10,
opacity = 0.8,
maptype = "terrain",
outsideOnly = TRUE
)
|
pas |
PurpleAir Synoptic pas object. |
parameter |
Value to plot, e.g. |
paletteName |
Predefined color palette name. Can be of the following:
|
radius |
Radius (pixels) of monitor circles. |
opacity |
Opacity of monitor circles. |
maptype |
Optional name of leaflet ProviderTiles to use, e.g. |
outsideOnly |
Logical specifying subsetting for monitors marked as 'outside'. |
The maptype
argument is mapped onto leaflet "ProviderTile"
names. Current mappings include:
"roadmap" – "OpenStreetMap"
"satellite" – "Esri.WorldImagery"
"terrain" – "Esri.WorldTopoMap"
"toner" – "Stamen.Toner"
If a character string not listed above is provided, it will be used as the underlying map tile if available. See https://leaflet-extras.github.io/leaflet-providers/ for a list of "provider tiles" to use as the background map.
A leaflet "plot" object which, if not assigned, is rendered in Rstudio's 'Viewer' tab.
The paletteName
parameter can take the name of an RColorBrewer
paeltte, e.g. "BuPu"
or "Greens"
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | library(AirSensor)
setArchiveBaseUrl("http://data.mazamascience.com/PurpleAir/v1")
# California
ca <-
pas_load() %>%
pas_filter(stateCode == 'CA')
if ( interactive() ) {
pas_leaflet(ca, parameter = "pm25_1hr")
pas_leaflet(ca, parameter = "temperature")
pas_leaflet(ca, parameter = "humidity")
pas_leaflet(ca, parameter = "pwfsl_closestDistance", maptype = "satellite")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.