# see https://groups.google.com/forum/#!topic/opendatasicilia/vBVlzqdTW7M library(stringi) library(leaflet) library(htmlwidgets) fix_lat_long <- function(x) { x <- gsub(".", "", x, fixed = TRUE) as.numeric(stringi::stri_pad_right(x, 8, 0)) / 1000000 } z <- read.csv("E:/ciro_scuole.csv") z$lat <- fix_lat_long(z$lat) z$long <- fix_lat_long(z$long) writexl::write_xlsx(z, "E:/ciro_scuole_fix.xlsx") z_leafmap <- leaflet() %>% addTiles() %>% addCircles(data = z, lng = ~long, lat = ~lat, popup = ~paste0(denominazione, " - ", sede_categoria)) z_leafmap htmlwidgets::saveWidget(z_leafmap, file = "E:/ciro_scuole_map.html")