I am working on a shiny app that incorporates a leaflet map with marker popups. Within the popup, I want to be able to provide a hyperlink based on a variable. I am able to establish a functioning hyperlink, however, it is not specific to the marker. Below is a sample of the code I am working with:
shinyServer(function(input, output) {
myData<-read_csv(...insert csv file here)
myData<-data.frame(myData)
output$myMap1 <- renderLeaflet({
pal <- colorFactor(c("#ad1d28", "#800080", "green", "blue", "navy"), domain = c("3", "4", "5", "6", "8"))
map1<-leaflet(data = myData[1:nrow(myData),]) %>% setView(lng = -86.7, lat = 32.7, zoom = 7) %>% addTiles() %>%
addPolygons(data=finalHex,fillColor="transparent",weight=1) %>%
addCircleMarkers(~LONGITUDE, ~LATITUDE, radius = 6,color=~pal(Variable1),stroke=FALSE,fillOpacity=0.75,
popup = ~paste0("Add some text here",Variable2,'<BR>',"Add some text here",
Variable3, '<BR>',"Add some text here",
Variable4,"%",'<BR>',"Add some text here",
Variable5,'<BR>',
a("View Input XML",target="_blank",href=paste0(Variable2,"Input.txt")),'<BR>'))
map1
})
})
This is the warning message received:
Warning in if (!is.na(attribValue)) { :
the condition has length > 1 and only the first element will be used
Warning in charToRaw(text) :
argument should be a character vector of length 1
all but the first element will be ignored
Thanks!