Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

leaflet_map

Simple Leaflet Maps


Description

Primarily designed to work with rgeo() to display randomly sampled points on the globe.

Usage

leaflet_map(
  latitude = NULL,
  longitude = NULL,
  position = NULL,
  zoom = 12,
  mark = FALSE,
  radius = 0,
  units = c("km", "miles", "meters", "feet"),
  ...
)

Arguments

latitude, longitude

vectors of latitude and longitude values. If latitude is a data frame, then it is treated as position. This facilitates "piping" from rgeo(). See examples.

position

a data frame containing latitude and longitude positions

zoom

zoom level for initial map (1-20)

mark

a logical indicating whether the location should be marked with a pin

radius

a vector of radii of circles (in miles) centered at position that are displayed on the map

units

units for radii of circles (km, miles, meters, or feet).

...

additional arguments passed to leaflet::addCircles()

Value

a leaflet map

See Also

Examples

# Times Square
  leaflet_map(40.7566, -73.9863, radius = 1, units = "miles")  
  # 3 random locations; 5 km circles
  leaflet_map(position = rgeo(3), radius = 5, mark = TRUE, color = "red") 
  # using pipes
  rgeo(4, latlim = c(25,50), lonlim = c(-65, -125)) %>%
    leaflet_map(radius = 5, mark = TRUE, color = "purple")

mosaic

Project MOSAIC Statistics and Mathematics Teaching Utilities

v1.8.3
GPL (>= 2)
Authors
Randall Pruim [aut, cre], Daniel T. Kaplan [aut], Nicholas J. Horton [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.