R Shiny:错误 Navbarpage Argument is missing with no default, shiny R

R Shiny: Error Navbarpage Argument is missing with no default, shiny R

我对 shiny R 还很陌生,我对它的格式很困扰。我不知道如何组织它更清洁。我觉得我已经检查了一切,但我不知道我错过了什么。它一直给我 ErrorNavbarPage argument is missing with no default!我的代码哪里错了?谢谢

ui <- fluidPage(
  navbarPage(title = "Demo Bar",
             tabPanel("Percent college",
                      sidebarLayout(
                        sidebarPanel(
                          selectInput(inputId = "state", label = "Select a state:",
                                      choices = unique(midwest$state),
                                      selected = "IL",
                                      multiple = TRUE),
                          hr(),
                          helpText("Data From Midwest data frame"),
                          textInput(inputId = "title", label = "Write a title!", value = "Midwest scatter plot comparison")
                        ),
                        mainPanel(
                          plotlyOutput(outputId = "scatterplot")
                        ),
                      ),
             ),
             tabPanel("Data Page",
                      sidebarLayout(
                        sidebarPanel(
                          sliderInput(
                            inputId = "area_choice",
                            label = "Range of Area",
                            min = area_range[1],
                            max = area_range[2],
                            value = area_range
                          ),
                        ),
                          mainPanel(
                            plotOutput("plot")
                          ),
                      ),
             ),
  ),
)

没有额外逗号的工作代码:

ui <- fluidPage(
  navbarPage(
    title = "Demo Bar",
             tabPanel("Percent college",
                      sidebarLayout(
                        sidebarPanel(
                          selectInput(inputId = "state", label = "Select a state:",
                                      choices = unique(midwest$state),
                                      selected = "IL",
                                      multiple = TRUE),
                          hr(),
                          helpText("Data From Midwest data frame"),
                          textInput(inputId = "title", label = "Write a title!", value = "Midwest scatter plot comparison")
                        ),
                        mainPanel(
                          plotOutput("plot1")
                          #plotlyOutput(outputId = "scatterplot")
                        ),
                      ),
             ),
             tabPanel("Data Page",
                      sidebarLayout(
                        sidebarPanel(
                          sliderInput(
                            inputId = "area_choice",
                            label = "Range of Area",
                            min = 1, #area_range[1],
                            max = 10, #area_range[2],
                            value = 5 #area_range
                          )
                        ),
                        mainPanel(
                          plotOutput("plot2")
                        )
                      )
             )
  )
)

server <- function(input, output, session) {
    output$plot1 <- renderPlot(plot(cars))
    output$plot2 <- renderPlot(plot(pressure))
}

shinyApp(ui, server)