call myFunction daily, at specific time, in shiny?

2019-07-18 13:35发布

问题:

im looking for a way to call a function daily at %H:%M in server.R of a deployed shiny app. using an infinite loop to "watch the clock" is probably a sin and doesnt work. any ideas?

ui.R

library(shiny)
shinyUI(fluidPage("floou", textOutput("foo")))

server.R

library(shiny)
myFunction <- function() {...}
repeat {  # same behavior with while (T)
  # Sys.sleep(60)  # also tried sleeping
  if (format(as.POSIXlt(Sys.time(), tz = "GMT"), "%H:%M") == "21:00") {
    myFunction()  # func not called + rendering blocked -> approach not working
  }
}
shinyServer(function(input, output) {
  output$foo <- renderText("not rendering with infinite loop")
})
标签: r timer shiny