我写了一个简单的shiny App,Input的部分使用了一个复选框,在没有进行选择的情况下始终报错"Error: Object "2019" not found",但是一旦进行了选择,一切运行良好,请问怎么能让它在初始状态不报错。
下面是有问题的代码
A <- reactive({
mydata %>%
filter(State %in% input$State) %>%
distinct() %>%
spread(Year, Number) %>%
mutate(
19= (
2019-
2018)/
2018*100) %>%
select(-
2018, -
2019) %>%
gather(Year, Difference,
19)
})