![]() Using a reactive, as in Figure 16.4, makes the precise connection easy to see. It’s misleading because it doesn’t look like nrows is connected to df(). It’s informative to compare the two reactive graphs.įigure 16.3 shows the graph from the first example. You end up doing a lot of hard work to analyse the flow of events in your app, rather than relying on Shiny to handle it for you automatically. It’s very easy to revert to the event-driven programming situation described in Section 13.2.3. If the head() throws an error, the observe() will terminate the app, but reactive() will propagate it so it’s displayed reactive throws an error, it won’t get propagated.Īnd things will get progressively worse as the app gets more complicated. ![]() If the table or plot are in tabs that are not currently visible, the observer will still draw/plot them. Ui <- fluidPage ( actionButton ( "start", "start" ), actionButton ( "stop", "stop" ), textOutput ( "n" ) ) server <- function ( input, output, session ) I wouldn’t recommend you use them in “real” apps, but reading the source code might be illuminating. These are both experimental packages, designed to explore “higher order” reactivity, reactives that are created programmatically from other reactives. If you find the ideas explored in this chapter to be interesting, you might also want to look at the shinySignals and rxtools packages. Most importantly, you can now create infinite loops where your app gets stuck in a cycle of updates that never ends. These techniques are powerful because they give you manual control over parts of the graph.īut they’re also dangerous because they allow your app to do unnecessary work. ![]() In this chapter you’ll learn how you can combine reactiveValues() and observe()/ observeEvent() to connect the right hand side of the reactive graph back to the left hand side. Shiny’s reactive programming framework is incredibly useful because it automatically determines the minimal set of computations needed to update all outputs when an input changes.īut this framework is deliberately constraining, and sometimes you need to break free to do something risky but necessary.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |