我与R Shiny selectInput有类似的问题,我想使用input
像这样对数据进行切片:
selectInput("category", "Choose a Category:",
choices = c('Any', levels(as.factor(unique(BD$DX_01_Cat))))),
uiOutput("secondSelection")
if (input$category != "Any"){
subsetSubsTab <<- subsetSubsTab[subsetSubsTab$DX_01_Cat==input$category];
output$secondSelection <- renderUI({
selectInput("subdiagnosis", "Choose a Subdiagnosis:", choices = c("Any", as.character(subsetSubsTab[subsetSubsTab$DX_01_Cat==input$category, DX_01_Sub])) , selected = "Any")
})
if (input$subdiagnosis != "Any"){
subsetSubsTab <<- subsetSubsTab[subsetSubsTab$DX_01_Sub==input$subdiagnosis];
}
但最后一个if statement
无效。
我收到警告Warning: Error in if: argument is of length zero
,
subsetSubsTab
实现一秒钟然后返回。有人可以帮忙吗?