Priority value in reactive() like in observe() (R Shiny) -
how set priority in reactive()
calculations performed in shiny? example, there priority
option in observe()
, quoting file
priority integer or numeric controls priority observer should executed. observer given priority level execute sooner observers lower priority level. positive, negative, , 0 values allowed.
i wish apply having shiny dashboard display summary statistics before writing these statistics logging database, here example
in server.r
retrieve data every hour
observe({ invalidatelater(3600000,session) con <- dbconnect(postgresql(), ...) values$data = dbgetquery(con, "select * table;") }) output$text = rendertext({ temp = values$data print(paste("the mean is", mean(temp))) }) observe({ temp = values$data dbwritetable(con, paste0("insert table_means values (", (mean(temp),");" )) })
and in ui.r
print mean of data.
i wish rendering in ui occur before writing values sql database
here related questions:
r shiny observe running before loading of ui , causes null parameters
i may have found answer in question: r shiny passing reactive selectinput choices
**using outputoptions
1 can following (pasted file):
## not run: # list of options observers within output outputoptions(output) # disable suspend output$myplot outputoptions(output, "myplot", suspendwhenhidden = false) # change priority output$myplot outputoptions(output, "myplot", priority = 10) # list of options output$myplot outputoptions(output, "myplot") ## end(not run)
so allows set priority of output items, still doesn't tell me how these priorities relative observe()
priority.
Comments
Post a Comment