Flavio Oliveri
04 November 2019
This example demonstrates a core feature of Shiny: reactivity. In the server function, a reactive called datasetInput is declared.
Notice that the reactive expression depends on the input expression input$dataset, and that it's used by two output expressions: output$summary and output$view. Try changing the dataset (using Choose a dataset) while looking at the reactive and then at the outputs; you will see first the reactive and then its dependencies flash.
Notice also that the reactive expression doesn't just update whenever anything changes–only the inputs it depends on will trigger an update. Change the “Caption” field and notice how only the output$caption expression is re-evaluated; the reactive and its dependents are left alone.
Cars dataset
speed dist
1 4 2
2 4 10
3 7 4
4 7 22
5 8 16
6 9 10
Rock dataset
area peri shape perm
1 4990 2791.90 0.0903296 6.3
2 7002 3892.60 0.1486220 6.3
3 7558 3930.66 0.1833120 6.3
4 7352 3869.32 0.1170630 6.3
5 7943 3948.54 0.1224170 17.1
6 7979 4010.15 0.1670450 17.1