I want to add markers on a world map and when the user clicks in one marker, instead of a popup it would direct the user to another website.
I'm new to this library (actually it's the first one i've tried in order to solve this issue - an interactive map with hyperlinks markers for the user to click and go to another website), so all i could do was:
map <- leaflet() %>%
addTiles()%>%
addMarkers(lng=174.768, lat=-36.852, popup="https://www.r-project.org/")
Is there a way to do wha i want with leaflet in R? if not, can you suggest another library?
Thank you very much
Use HTML in the popup
portion...
library("leaflet")
map <- leaflet() %>%
addTiles()%>%
addMarkers(lng=174.768, lat=-36.852,
popup='<a href="https://www.r-project.org/">R Project</a>')
Also, if you don't want to paste()
your links together, the shiny
library has functions for this...
shiny::a("something", href="www.something.com")
# <a href="www.something.com">something</a>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With