如何在传单地图上添加按钮以显示和隐藏以下 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)
bscols(leaflet(sdf) %>% addTiles() %>%
addMarkers(~ Long, ~ Lat),
datatable(sdf, width = "100%"))
需要添加一个按钮来处理显示/隐藏数据表部分,如下图所示: