Skip to content

Instantly share code, notes, and snippets.

@sanealytics
Last active August 29, 2015 13:56
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 sanealytics/8790736 to your computer and use it in GitHub Desktop.
Save sanealytics/8790736 to your computer and use it in GitHub Desktop.
runApp(list(
ui = bootstrapPage(
uiOutput("nUI"),
plotOutput('plot'),
submitButton("PlotIt")
),
server = function(input, output, session) {
output$plot <- renderPlot({ hist(runif(input$obs)) })
output$nUI <- renderUI({
query <- parseQueryString(session$clientData$url_search)
if(is.null(input$obs) & !is.null(query$obs)) {
obs <- query$obs
} else {
if(!is.null(input$obs)) {
obs <- input$obs
} else {
obs <- 100
}
}
numericInput('obs', 'Number of obs', obs)
})
}
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment