闪亮:表格输出错误:长度为0的参数

时间:2018-08-03 14:38:08

标签: r function shiny shiny-reactivity

问题:

我正在尝试过滤使用闪亮的selectizeinput下拉列表创建的表。我有一个if if控制流,但对我来说是错误的。

我相信我已经按部就班了,但是我似乎无法理解这是否是一个简单的语法错误。

这里是反应性表达式,显示长度为0的错误参数。非常感谢您的帮助。

代码:

      days_to_respond_reactive <- reactive({

    if((!is.null(input$date)) & (input$name != "ALL")) {
      filtered <-
        final_data %>%
        filter(as.character(date_months) %in% c(input$date)) %>%
        filter(NAME %in% c(input$name)) %>%
        group_by(NAME) %>%
        summarize(
          Count = sum(SOLICITATION_COUNT),
          Avg_Days_to_Respond = round(mean(DAYS_TO_RESPOND, na.rm = TRUE)))

    } else if ((!is.null(input$date)) & (input$name == "ALL")) {
      filtered <-
        final_data %>%
        filter(as.character(date_months) %in% c(input$date)) %>%
        group_by(NAME) %>%
        summarize(
          Count = sum(SOLICITATION_COUNT),
          Avg_Days_to_Respond = round(mean(DAYS_TO_RESPOND, na.rm = TRUE)))

    } else if ((is.null(input$date)) & (input$name == "ALL")) {
      filtered <-
        final_data %>%
        summarize(
          Count = sum(SOLICITATION_COUNT),
          Avg_Days_to_Respond = round(mean(DAYS_TO_RESPOND, na.rm = TRUE)))

    } else {
        filtered <-
          final_data %>%
          filter(SOLICITOR_NAME %in% c(input$name)) %>%
          group_by(NAME) %>%
          summarize(
            Count = sum(SOLICITATION_COUNT),
            Avg_Days_to_Respond = round(mean(DAYS_TO_RESPOND, na.rm = TRUE)))
    }
    return(filtered)
  })

0 个答案:

没有答案