Skip to content

Instantly share code, notes, and snippets.

@stephlocke
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephlocke/1ddbee9f050e818fef41 to your computer and use it in GitHub Desktop.
Save stephlocke/1ddbee9f050e818fef41 to your computer and use it in GitHub Desktop.
Decluttering your shiny app with modularity
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)
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