-
-
Save stephlocke/1ddbee9f050e818fef41 to your computer and use it in GitHub Desktop.
Decluttering your shiny app with modularity
This file contains hidden or 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
| source("inputcontrols.R") | |
| server <- function(input, output) { | |
| output$distPlot <- renderPlot({ | |
| hist(rnorm(input$obs), col = 'darkgray', border = 'white') | |
| }) | |
| } | |
| ui <- fluidPage( | |
| sidebarLayout( | |
| sidebarPanel( | |
| inputcontrols | |
| ), | |
| mainPanel(plotOutput("distPlot")) | |
| ) | |
| ) | |
| shinyApp(ui = ui, server = server) |
This file contains hidden or 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
| inputcontrols<-list( | |
| sliderInput("obs", "Number of observations:", min = 10, max = 500, value = 100) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment