简体   繁体   English

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

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

I have a problem with my shiny app. 我的闪亮应用程序有问题。 I try to make second selectInput ( model ) to be dependent from choice made in first selectInput ( marka ) but it still not working. 我尝试使第二个selectInput( model )依赖于在第一个selectInput( marka )中所做的选择,但是它仍然无法正常工作。

I found this topic Using the input from updateSelectInput and it works on my computer so i did exactly the same thing with my data (there are in PogromcyDanych package). 我发现了这个主题, 使用了updateSelectInput的输入,并且可以在我的计算机上使用,因此我对数据进行了完全相同的操作(位于PogromcyDanych软件包中)。 Unfortunately it's not working, I'm hopeless. 不幸的是,它没有用,我绝望。 I get the warning message: 我收到警告消息:

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

Below there are my server.R and ui.R files: 下面是我的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)
   })

})

ui: 用户界面:

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"))
      )
    )
  )
))

You have a sintax error in the select input id! 选择输入的ID中有一个sintax错误! ( "Marka" and "Model" with capital letter) (带有大写字母的"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.

相关问题 Error :: is.na()应用于&#39;NULL&#39;类型的非(列表或向量) - Error:: is.na() applied to non-(list or vector) of type 'NULL' 在is.na(e2)中:is.na()应用于类型为“ NULL”的非(列表或向量) - In is.na(e2) : is.na() applied to non-(list or vector) of type 'NULL' 循环错误:is.na()应用于类型为“ NULL”的非(列表或向量) - Error in loop: is.na() applied to non-(list or vector) of type 'NULL' 应用于&#39;NULL&#39;类型的非(列表或向量)的is.na()是什么意思? - What does is.na() applied to non-(list or vector) of type 'NULL' mean? 为什么 ggplot annotate 会抛出此警告:在 is.na(x): is.na() 应用于“表达式”类型的非(列表或向量) - Why does ggplot annotate throw this warning: In is.na(x) : is.na() applied to non-(list or vector) of type 'expression' 在带有管道函数的向量中应用 is.na() 函数 - Applying is.na() function in a vector with pipe function 错误ggplotly:VECTOR_ELT()只能应用于&#39;list&#39;,而不是&#39;NULL&#39; - Error ggplotly: VECTOR_ELT() can only be applied to a 'list', not a 'NULL' R错误:应用于非向量的names() - R Error: names() applied to a non-vector 在if语句中使用is.na()和!is.na() - Using is.na() and !is.na() in if statements R:删除少于20个非“ NA”值的行 - R: Remove rows with less than 20 non-“NA” values
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM