Skip to content

Instantly share code, notes, and snippets.

@wch
Last active December 13, 2015 19:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save wch/4963887 to your computer and use it in GitHub Desktop.
Save wch/4963887 to your computer and use it in GitHub Desktop.
Shiny demo of actionButton
shinyServer(function(input, output) {
output$distPlot <- renderPlot({
# Take a dependency on input$goButton
input$goButton
# Use isolate() to avoid dependency on input$obs
dist <- isolate(rnorm(input$obs))
hist(dist)
})
})
library(shinyIncubator)
shinyUI(pageWithSidebar(
headerPanel("Click the button"),
sidebarPanel(
sliderInput("obs", "Number of observations:",
min = 0, max = 1000, value = 500),
actionButton("goButton", "Go!"),
p(br(), a("View source code", href="https://gist.github.com/wch/4963887"))
),
mainPanel(
plotOutput("distPlot")
)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment