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 PM2.5 values from one of:

  • "pm2.5_10minute"

  • "pm2.5_30minute"

  • "pm2.5_60minute" (aka "pm25")

  • "pm2.5_6hour"

  • "pm2.5_24hour"

  • "pm2.5_1week"

pas_leaflet(
  pas = NULL,
  parameter = "pm25",
  paletteName = NULL,
  radius = 10,
  opacity = 0.8,
  maptype = "terrain"
)

Arguments

pas

PurpleAir Synoptic pas object.

parameter

Value to plot, e.g. pm2.5_60minute.

paletteName

RColorBrewer palette name to use when parameter is something other than:

  • "pm2.5_~"

  • "humidity

  • "temperature

radius

Radius (pixels) of monitor circles.

opacity

Opacity of monitor circles.

maptype

Optional name of leaflet ProviderTiles to use, e.g. terrain.

Value

A leaflet "plot" object which, if not assigned, is rendered in Rstudio's 'Viewer' tab.

Details

The maptype argument is mapped onto leaflet "ProviderTile" names. Current mappings include:

  1. "roadmap" -- "OpenStreetMap"

  2. "satellite" -- "Esri.WorldImagery"

  3. "terrain" -- "Esri.WorldTopoMap"

  4. "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.

Note

The paletteName parameter can take the name of an RColorBrewer paeltte, e.g. "BuPu" or "Greens".

Examples

library(AirSensor)

if ( interactive() ) {
  pas_leaflet(example_pas, parameter = "pm25")

  pas_leaflet(example_pas, parameter = "temperature")

  pas_leaflet(example_pas, parameter = "humidity")
}