始める無料で始める

Reactivity: effects of isolation

If there is a reactive variable that appears multiple times in your code, and you want to ensure that its modification does not trigger a re-evaluation of the code, you need to isolate all the instances of that variable. That means that if a variable x is inside an isolate() but also appears outside of it, then it will trigger reactivity.

The following code defines a reactive variable result and calculates it using three input values:

result <- reactive({
  temp <- input$X + input$Y
  isolate({
    temp <- temp * input$Y * input$Z
  })
  temp
})

In the code above, when does the result reactive variable get updated?

この演習はコースの一部です

Case Studies: Building Web Applications with Shiny in R

コースを見る

実践的なインタラクティブ演習

理論を実践に変える、インタラクティブな演習のひとつをお試しください

演習を開始する