代码之家  ›  专栏  ›  技术社区  ›  anderlaini

r simple shiny table找不到列

  •  1
  • anderlaini  · 技术社区  · 6 年前

    我试图在一个组合框上显示一个过滤值的简单表。

    library(shiny)
    library(readxl)
    library(plyr)
    library(magrittr)
    library(ggplot2)
    
    REGISTROS <- read_xlsx("~/folder/my-file.xlsx", col_names=TRUE)
    
    ui <- fluidPage(
    
      titlePanel("Ociosidade de loja"),
    
      sidebarLayout(
        sidebarPanel(
    
          selectInput("lojaInput",
                      label = "Loja",
                      choices = unique(REGISTROS$loja),
                      selected = 1)
    
        ),
    
        mainPanel(
          tableOutput("RESULTADO_LISTA")
        )
    
      )
    )
    
    server <- function(input, output){
    
      output$RESULTADO_LISTA <- renderTable({
        filtered <-
          REGISTROS %>%
          filter(
            loja == input$lojaInput          <=== ERROR LINE = object 'loja' not found
          )
        filtered
      })
    
    }
    
    shinyApp(ui = ui, server = server)
    

    它工作了几次,但现在它说错误 object 'loja' not found .

    selectInput使用相同的数据并正确填充。另外,我可以在环境变量上看到这些值。。。

    weekday        time_entry        mins              loja       group
    seg 12         587               Thoughtsphere     Maroon     Morumb
    

    思想?

    1 回复  |  直到 6 年前
        1
  •  1
  •   TheDataGuy    6 年前

    你的代码没有问题。这对我来说非常有效。

    编辑: 尝试安装并加载 dplyr 包装处理你的管道