Вопрос

Is there a difference between

values <- reactiveValues()

observe({
invalidateLater(1,session)
values$data_1 = ... #do some calculation
values$data_2 = ... #do some calculation
})

and

values1 <- reactiveValues()
values2 <- reactiveValues()    
observe({
invalidateLater(1,session)
values1$data_1 = ... #do some calculation
values2$data_2 = ... #do some calculation
})

Is there a reason why you wouldn't combine all your data storage into just one reactiveValues() expression?

Это было полезно?

Решение

As mentioned in the comment in general you would only have one reactiveValues unless you wanted more for bookkeeping etc. However it maybe the case that you want two reactiveValues The first reactiveValues is declared globally in say for example global.R or outside shinyServer. This reactiveValues handles stored values across users. The second reactiveValues would be declared within shinyServer. This reactiveValues would be for storing values for a users particular session.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top