Created
October 16, 2017 03:14
-
-
Save dkulp2/d897c21dfd1a20f9531b6454ea02a533 to your computer and use it in GitHub Desktop.
Deferred UI breaks Shiny app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# example Shiny app where uiOutput is only rendered when panel is selected, but other | |
# items are dependent on the deferred UI. | |
library(shiny) | |
ui <- fluidPage( | |
tabsetPanel(tabPanel("Main", | |
plotOutput("dots")), | |
tabPanel("Settings", | |
# checkboxInput('even','Even?',TRUE) | |
uiOutput("even.or.odd") | |
) | |
) | |
) | |
server <- function(input, output) { | |
output$dots <- renderPlot({ | |
plot(seq(ifelse(input$even, 0, 1), 20, 2)) | |
}) | |
output$even.or.odd <- renderUI(checkboxInput('even', "Even?",TRUE)) | |
} | |
shinyApp(ui = ui, server = server) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment