簡體   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