Skip to content

Instantly share code, notes, and snippets.

@stephlocke stephlocke/app
Last active Aug 29, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.