Exercises

  1. What are the differences between these two lists of reactive values? Compare the syntax for getting and setting individual reactive values.
# Defining values
l1 <- reactiveValues(a = 1, b = 2)
l2 <- list(a = reactiveVal(1), b = reactiveVal(2))
# ... with a little extra
l3 <- reactiveVal(list(a = 1, b = 2))
# Getting
l1$a; l1[["a"]]
l2$a(); l2[["a"]]()
l3()$a; l3()[["a"]]

# Setting
l1$a <- 15
l2$a(15)
# For l3, can't easily update just 'a'
l3(list(a = 15, b = 2))