Geocoding of publicly-available GP practice location in New Zealand

app.R 818B

12345678910111213141516171819202122232425262728
  1. library(shiny)
  2. library(leaflet)
  3. library(janitor)
  4. library(dplyr)
  5. library(readr)
  6. Geo2017 <- clean_names(read_csv("../data/AllDHBsGeocoded.csv"), case = "snake") %>%
  7. select(-facility_opening_date) %>%
  8. mutate(dhb_name = ifelse(is.na(dhb_name), "Missing", dhb_name),
  9. health_facility_code = ifelse(is.na(health_facility_code),
  10. "Missing", health_facility_code))
  11. ui <- fillPage(
  12. leafletOutput(outputId = "medmap", height = "100%")
  13. )
  14. server <- function(input, output) {
  15. output$medmap <- renderLeaflet({
  16. leaflet(Geo2017) %>%
  17. addTiles() %>%
  18. addMarkers(lng = Geo2017$lon,
  19. lat = Geo2017$lat,
  20. popup = Geo2017$name)
  21. })
  22. }
  23. # Run the application
  24. shinyApp(ui = ui, server = server)