【发布时间】:2020-11-12 14:38:34
【问题描述】:
在我的应用程序中,我希望 plot1 默认显示,然后如果单击操作按钮,让 plot2 替换 plot1。如果再次单击,则恢复为 plot1,依此类推。
server <- function(input, output, session) {
plot1 <- (defined here)
plot2 <- (defined here)
which_graph <- reactive({
if (input$actionbutton == 1) return(plot1)
if (input$actionbutton == 2) return(plot2)
})
output$plot <- renderPlot({
which_graph()
})
}
【问题讨论】:
标签: r shiny action-button