apps/webinar_2/code/07-eventReactive.R

# 07-eventReactive

library(shiny)

ui <- fluidPage(
  sliderInput(inputId = "num",
    label = "Choose a number",
    value = 25, min = 1, max = 100),
  actionButton(inputId = "go",
    label = "Update"),
  actionLink(inputId = "link",
    label = "Update"),
  plotOutput("hist")
)

server <- function(input, output) {
  data <- eventReactive(input$go, {
    rnorm(input$num)
  })

  output$hist <- renderPlot({
    hist(data())
  })
}

shinyApp(ui = ui, server = server)
rappster/shinyref documentation built on May 27, 2019, 2:01 a.m.