Shiny Concepts Without Runtime
Reactive Value
Recompute a Summary
Reactive expressions recompute derived values when their inputs change.
Program
Play the script to change the modeled input count and see the derived total update.
reactive_value.R
input_count <-
base <- c(5, 10, 15)
limit <- input_count * 3
filtered <- base[base <= limit]
total <- sum(filtered)
label <- paste("reactive", total, sep = ":")
cat(label, "\n", sep = "")
input_count <-
base <- c(5, 10, 15)
limit <- input_count * 3
filtered <- base[base <= limit]
total <- sum(filtered)
label <- paste("reactive", total, sep = ":")
cat(label, "\n", sep = "")
input_count <-
base <- c(5, 10, 15)
limit <- input_count * 3
filtered <- base[base <= limit]
total <- sum(filtered)
label <- paste("reactive", total, sep = ":")
cat(label, "\n", sep = "")
input dependency
The derived limit depends on the selected input count.
reactive expression
Filtering and summing model a reactive expression recomputing from inputs.
output value
The final label is the value an output binding could display.