繁体   English   中英

闪亮错误is.na()应用于类型为'NULL'的非(列表或向量)

[英]Shiny error is.na() applied to non-(list or vector) of type 'NULL'

我的闪亮应用程序有问题。 我尝试使第二个selectInput( model )依赖于在第一个selectInput( marka )中所做的选择,但是它仍然无法正常工作。

我发现了这个主题, 使用了updateSelectInput的输入,并且可以在我的计算机上使用,因此我对数据进行了完全相同的操作(位于PogromcyDanych软件包中)。 不幸的是,它没有用,我绝望。 我收到警告消息:

Warning in run(timeoutMs) :
  is.na() applied to non-(list or vector) of type 'NULL'
Warning in run(timeoutMs) : 

下面是我的server.Rui.R文件:

library(shiny)
library(PogromcyDanych)
library(dplyr)

shinyServer(function(input, output, session) {

   dane <- auta2012

   observe({
      marka <- input$Marka
      ktore <- dane %>%
         filter(Marka == marka) %>%
         arrange(Model) %>%
         select(Marka, Model)
      updateSelectInput(session, "model", 
                        choices = levels(factor(ktore$Model)), 
                        selected = levels(factor(ktore$Model))[1])
   })

   dane.cena <- reactive({
      dane %>% 
         filter(Marka == input$Marka, Model == input$Model)
   })

})

用户界面:

library(shiny)
library(PogromcyDanych)
dane <- auta2012

shinyUI(fluidPage(
  titlePanel("Znajdź swój samochód!"),
  sidebarLayout(
    sidebarPanel(
      selectInput("marka",
                  "Wybierz markę",
                  levels(dane$Marka),
                  levels(dane$Marka)[1]),

      selectInput("model",
                  "Wybierz model",
                  levels(dane$Model),
                  levels(dane$Model)[1])
    ),

    mainPanel(
      h1("Ceny samochodów:"),
      br(),
      tabsetPanel(
        tabPanel("Boxplot", plotOutput("boxplot", width = 500)),
        tabPanel("Histogram", plotOutput("histogram", width = 500)),
        tabPanel("Podsumowanie", verbatimTextOutput("podsumowanie")),
        tabPanel("Tabela", tableOutput("tabela"))
      )
    )
  )
))

选择输入的ID中有一个sintax错误! (带有大写字母的"Marka""Model"

  selectInput("Marka",
              "Wybierz markę",
              levels(dane$Marka),
              levels(dane$Marka)[1]),

  selectInput("Model",
              "Wybierz model",
              levels(dane$Model),
              levels(dane$Model)[1])

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM