Created
January 21, 2021 11:18
-
-
Save verajosemanuel/55df483c23f168fffafc2ef139a84f9f to your computer and use it in GitHub Desktop.
#leaflet #map add #multiline #label in #R
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| labs <- lapply(seq(nrow(df)), function(i) { | |
| paste0( "<font color='purple'>",df[i, "nombre"], ', ', | |
| df[i, "provincia"], '</font></br>', | |
| "(", | |
| round(df[i, "coord_lat"],2),' / ', | |
| round(df[i, "coord_lon"],2), | |
| ")") | |
| }) | |
| map <- leaflet( df ) %>% | |
| addTiles() %>% | |
| addMarkers(lng = ~coord_lon, | |
| lat = ~coord_lat, | |
| label = lapply(labs, htmltools::HTML)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment