【发布时间】:2020-09-16 18:57:08
【问题描述】:
当我使用selectInput 的内容来显示某些内容时,它无法正常工作:首先它可以工作,但它会立即重置selectInput。
我使用的是 R 版本 3.5.0 和 Shiny 1.2.0。
这是重现该行为的极简示例:
simpleList <- list("..." = -1, "A" = 1, "B" = 2, "C" = 3)
ui <- fluidPage(
mainPanel(
tabsetPanel(type = "tabs",
tabPanel("Test", uiOutput("test"))
)
)
)
server <- function(input, output, session) {
output$test <- renderUI({
tagList(
selectInput("pole", "Pôle", choices = simpleList),
h3(paste0("Pôle : ", poleChoisi()))
)
})
poleChoisi <- reactive({
if("pole" %in% names(input))
return(input$pole)
else
return("...")
})
}
shinyApp(ui = ui, server = server)
我认为我做错了什么,但我不明白。非常感谢您的帮助。
最好的,
ChoCchoK.
【问题讨论】: