Description Usage Arguments Details Value Examples
View source: R/monitor_leaflet.R
This function creates interactive maps that will be displayed in RStudio's
'Viewer' tab. The slice argument is used to collapse a
ws_monitor timeseries into a single value. If slice is an
integer, that row index will be selected from the ws_monitor$data
dataframe. If slice is a function (unquoted), that function will be
applied to the timeseries with the argument na.rm=TRUE (e.g.
max(..., na.rm=TRUE)).
If slice is a user defined function it will be used with argument
na.rm=TRUE to collapse the time dimension. Thus, user defined
functions must accept na.rm as an argument.
| 1 2 3 4 5 6 7 8 9 10 11 12 | 
| ws_monitor | ws_monitor object | 
| slice | either a time index or a function used to collapse the time axis
– defautls to  | 
| breaks | set of breaks used to assign colors | 
| colors | a set of colors for different levels of air quality data
determined by  | 
| labels | a set of text labels, one for each color | 
| legendTitle | legend title | 
| radius | radius of monitor circles | 
| opacity | opacity of monitor circles | 
| maptype | optional name of leaflet ProviderTiles to use, e.g. "terrain" | 
| popupInfo | a vector of column names from ws_monitor$meta to be shown in a popup window | 
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.
Invisbly returns a leaflet map of class "leaflet".
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Not run: 
# Fail gracefully if any resources are not available
try({
# Napa Fires -- October, 2017
ca <- airnow_load(2017) %>%
  monitor_subset(tlim = c(20171001,20171101), stateCodes = 'CA')
v_low <- AQI$breaks_24[5]
CA_very_unhealthy_monitors <- monitor_subset(ca, vlim = c(v_low, Inf))
monitor_leaflet(CA_very_unhealthy_monitors,
               legendTitle = "October, 2017",
               maptype = "toner")
}, silent = FALSE)
## End(Not run)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.