I wrote a shiny script which loads a Rda-File just at the initial execution. This Rda-file gets updated by an external process. How can I reload the Rda file when it was changed or how can I relaod the .Rda file at a special time, for instance every day at 6 am.
I guess I can use the reactiveTimer
function and if-clause with Sys.time()
, but I don't know how.
Thanks a lot for your ideas.
update, thanks to @jdharrison:
I tried the function reactiveFileReader
and my server.R Skript looks like this:
fileData <- reactiveFileReader(10000, session = NULL, filePath = "../data/myData.Rda", load)
shinyServer(function(input, output, session) {
output$mytable <- renderDataTable({
fileData()
myData # this is the name of the R-Object I loaded
})
})
Unfortunately I always get the error message : mydata not found
How can I use the data which loaded with the reactiveFileReader
function?
One solution is quite simple:
just add envir = .GlobalEnv
fileData <- reactiveFileReader(10000, session = NULL, filePath = "../data/myData.Rda", load, envir = .GlobalEnv)