我刚刚开始发现Rshiny,并且在玩了一周之后,我试图创建一个地图,其中由于功能“ selectizeInput”而只能显示某些多边形...
我认为,由于下面的脚本,我将设法做到这一点,但实际上却遇到了我无法解决的错误“无默认值的参数丢失”!
有人可以告诉我我在做什么错吗?
ui <- dashboardPage(
dashboardHeader(title ="Draft_1"),
dashboardSidebar(
sidebarMenu(
menuItem("Map", tabName = "counties", icon = icon('info')),
)
),
dashboardBody(
tabItems(
tabItem(tabName = "counties",
fluidRow(selectizeInput("COUNTIES_ID", choices = shapefile1, selected="NONE"))
),
fluidRow(leafletOutput("map-test", height = 500)),
)))
server <- function(input, output){
updateSelectizeInput(session,
"COUNTIES_ID",
choices = shapefile1,
options = list(maxOptions = 1000),
selected = "45FDG)
output$map-test<-renderLeaflet(
leaflet(shapefile1) %>%
setView(1.45, 43.52, zoom = 12) %>%
addTiles() %>%
addPolygons(fillColor = "blue",
weight = 2,
opacity = 1,
color = "white",
dashArray = "3",
fillOpacity = 0.3,
highlight = highlightOptions(
weight = 5,
color = "#666",
dashArray = "",
fillOpacity = 0.7,
bringToFront = TRUE),
layerId = ~COUNTIES_ID)
)}
shinyApp(ui, server)
答案 0 :(得分:0)
在以下末尾删除,
:
sidebarMenu(
menuItem("Map", tabName = "counties", icon = icon('info')),
)
此,
使sidebarMenu
期望另一个找不到的项目。