output$welcome_map <- renderLeaflet({
if(! data_provided()) {
return(
leaflet(data = coords) %>%
addTiles() %>%
addPolygons(data = shp_lao_provinces, fill = FALSE, dashArray = 1, weight = 0, color='black') %>%
addMarkers(lng = ~lon, lat = ~lat, label = ~hospcd) %>%
addMiniMap(zoomLevelOffset=-3, toggleDisplay = T)
)
}
if(data_provided()) {
dta <- patients() %>%
group_by(hospcd) %>%
count() %>%
mutate(label = paste0(hospcd, ": ", n))
dta <- left_join(dta, coords, by = "hospcd")
return(
leaflet(data = dta) %>%
addTiles() %>%
addPolygons(data = shp_lao_provinces, fill = FALSE, dashArray = 1, weight = 0, color='black') %>%
addMarkers(lng = ~lon, lat = ~lat, label = ~label, labelOptions = labelOptions(noHide = T))
)
}
})
output$text_map <- renderText({
glue("Data collected between {min(patient$surdate)} and {max(patient$surdate)}.")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.