Skip to content

Instantly share code, notes, and snippets.

@dkulp2
Created October 16, 2017 03:14
Show Gist options
  • Save dkulp2/d897c21dfd1a20f9531b6454ea02a533 to your computer and use it in GitHub Desktop.
Save dkulp2/d897c21dfd1a20f9531b6454ea02a533 to your computer and use it in GitHub Desktop.
Deferred UI breaks Shiny app
# 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