首页 > 解决方案 > Rshiny 中的错误:“没有默认值的参数丢失”

问题描述

我刚刚开始发现 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)

标签: rshiny

解决方案


删除,末尾的:

sidebarMenu(
      menuItem("Map", tabName = "counties", icon = icon('info')),
    )

,使得sidebarMenu期望另一个它没有找到的项目。


推荐阅读