小叶地图无法呈现以下代码。还要说明地图应如何适应闪亮仪表板中框的宽度。它检索推文但不渲染。
server.R
mapPlot <- function(searchTerm, maxTweets, lang, lat, long, rad){
mapTweets <- searchTwitter(searchTerm, maxTweets, lang = "en", geocode = paste(lat,long,paste0=(rad,"mi"),sep="'")
mapTweets.df <- twListToDF(mapTweets)
return(mapTweets.df)
}
entity13 <- eventReactive(input$mapit,{
entity13 <- mapPlot(input$k, input$nt, lang = "en", input$lat, input$long, input$rad)
entity13
})
output$mymap <- renderLeaflet({
m <- leaflet(entity13()) %>% addTiles() %>% # addCircles(ct$longitude, ct$latitude, weight = 20, radius=50, color="#000000", stroke = TRUE, fillOpacity = 0.8)
addMarkers(entity13()$longitude, entity13()$latitude, popup = entity13()$screenName)
# m %>% addPopups(~longitude, ~latitude, ~text)
m %>% setView(entity13()$longitude, entity13()$latitude, zoom = 4)
return(m)
})
ui.R
column(width = 8,
box(width = NULL, leafletOutput("mymap",height="500px"), collapsible = TRUE,
title = "Visualization of the place where the tweets popped from", status = "primary", solidHeader = TRUE)
)
传单地图未呈现。
有解决方法吗?