Case Studies: Building Web Applications with Shiny in R
Dean Attali
Shiny Consultant
reactive() and input$ are reactivex <- reactive({
y() * input$num1 * input$num2
})
isolate() to not create reactive dependencyisolate() is modified, nothing happensx <- reactive({
y() * isolate({ input$num1 }) * input$num2
})
x <- reactive({
y() * isolate({ input$num1 * input$num2 })
})
Sometimes you want to isolate all reactives
x <- reactive({
isolate({
y() * input$num1 * input$num2
})
})
Need a way to trigger x to re-run on demand
actionButton(inputId, label, ...)

# After clicking on a button twice
str(input$button)
int 2
Accessing button input value in server triggers reactivity
Add button to UI
actionButton(inputId = "calculate_x", label = "Calculate x!")
Access button to make it dependency
x <- reactive({
input$calculate_x
isolate({
y() * input$num1 * input$num2
})
})
Case Studies: Building Web Applications with Shiny in R