我使用r中的一些包绘制了一个带有“datatable”的Map。为了在传单图中有更多的空间,我需要一个按钮来显示/隐藏datatable部分。怎么做?r代码如下:
library(leaflet)
library(DT)
library(crosstalk)
df <- read.csv(textConnection(
"Name,Lat,Long
Samurai Noodle,47.597131,-122.327298
Kukai Ramen,47.6154,-122.327157
Tsukushinbo,47.59987,-122.326726"
))
sdf <- SharedData$new(df, df$Name)
lflt<-leaflet(sdf) %>% addTiles() %>%
addMarkers(~ Long, ~ Lat)%>%addEasyButtonBar(
easyButton(
icon = htmltools::span(class = "star", htmltools::HTML("+")),
onClick = JS("function(btn, map){ alert(\"Button 1\");}")))
bscols(lflt, datatable(sdf, width = "100%"))
暂无答案!
目前还没有任何答案,快来回答吧!