2
所以我是Rshiny和R的新手。我測試了TMAP包,當我鍵入到控制檯如何在Rshiny中輸出tmap_leaflet
> working_map <- readOGR(dsn=".",layer=file_name, GDAL1_integer64_policy=TRUE)
> japan <- tm_shape(working_map) + tm_fill(col="NumIB", title="# Inbound to Cities", style="jenks")
> tmap_leaflet(japan)
這我得到一個交互式單張小工具,讓我看到和放大和縮小像傳單。
但我不能將它集成到我的Rshiny應用程序中。
# ui.R
shinyUI(fluidPage(
mainPanel(
leafletOutput("working_map", height=900)
)
))
#server.R
output$working_map <- renderLeaflet({
working_map <- readOGR(dsn=".",layer=filename, GDAL1_integer64_policy=TRUE)
japan <- tm_shape(working_map) + tm_fill(col="NumIB", title="# Inbound to Cities", style="jenks")
tmap_leaflet(japan)
})
我試過各種組合。如plotOutput,或將tmap_leaflet放入ui.R.它似乎沒有工作。如果我沒有錯,tmap_leaflet創建一個Leaflet Widget。我應該在UI方面創建這個嗎?或者我應該使用global.R?