How do I create a working hyperlink within shiny and leaflet from information from a column from a csv file?
Say I have a csv InputFile as input into a Shiny and Leaflet app that looks like this...
Site# Lat Long Link
1 41.9582781716978, -112.15752297501899 <a href="https://google.com">Link</a>
2 41.9582781716978, -112.15752297501899 <a href="https://rstudio.github.io/leaflet/">Link</a>
etc
I'd like to create a map via leaflet with the hyperlink in the popup, but I can't get it work. Every time the returning popup string contains additional information about the local host or the shinyapp host, rather than just the html string I have in my InputFile (example, returned as https://shinyapps.io/appexample/https://google.com),
#Example Code
library(shiny)
library(leaflet)
FileInput <- read.csv("inputfile.csv")
ui <- fluidPage(leafletOutput("mapA")))
server <- function(input, output) {
output$mapA <- renderLeaflet({
leaflet(data = FileInput) %>%
addTiles("Title of Map") %>%
addCircleMarkers(
lng = FileInput$Long,
lat = FileInput$Lat,
popup = FileInput$Link)
)}
}
shinyApp(ui = ui, server = server)
dput(head(FileInput))to your question to make reproducible? - Ben