library(mapboxer)
LAYER_ID <- "crashes"
as_mapbox_source(motor_vehicle_collisions_nyc) %>%
mapboxer(
center = c(-73.9165, 40.7114),
zoom = 10
) %>%
add_circle_layer(
id = LAYER_ID,
circle_color = list(
"match", c("get", "injured"),
0, "yellow",
1, "orange",
"red"
),
circle_radius = list("+", c("get", "injured"), 2),
popup = "<p>{{date}} {{time}}</p><p>Number of persons injured: {{injured}}</p>"
) %>%
add_filter_control(
LAYER_ID,
filter = list(">=", "injured", 0),
pos = "top-left"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.