r-如何从csv输入栏在传单中创建工作超链接



如何从csv文件的列中的信息在shine和传单中创建工作超链接?

假设我有一个csv InputFile作为Shiny and Leaflet应用程序的输入,它看起来像这样。。。

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

我想通过传单创建一张地图,弹出窗口中有超链接,但我无法实现。每次返回的弹出字符串包含关于本地主机或shinyapp主机的附加信息,而不仅仅是我在InputFile中的html字符串(例如,返回为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)

啊哈。@Ben注意到,我在FileInput.csv中为链接列创建的字符串不正确,它一直包含额外的引号,我只注意到它在执行dput(head(FileInput((。我能够做一些字符串操作并使其工作。

最新更新