我写了一个闪亮的脚本,它在初始执行时加载一个 Rda 文件。此 Rda 文件由外部进程更新。如何在更改 Rda 文件时重新加载它,或者如何在特殊时间重新加载 .Rda 文件,例如每天早上 6 点。
我想我可以使用reactiveTimer
函数和 if 子句 with Sys.time()
,但我不知道如何。
非常感谢您的想法。
更新,感谢@jdharrison:
我尝试了这个功能reactiveFileReader
,我的 server.R Skript 看起来像这样:
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
})
})
不幸的是,我总是收到错误消息:mydata not found
如何使用该reactiveFileReader
函数加载的数据?