Schedule automatic updates on R

Asked

Viewed 186 times

4

I have an algorithm on designed in R that retrieves data from a database, does some statistical calculations and produces a Dashboard with kpis and graphs generated from these calculations. But every time I want to update the information, I have to perform the function so that the calculations are redone. Is there any way I can schedule an automatic update of these calculations in R as soon as I open the code and as I leave it open?

1 answer

5


Yes, it does. In a past job of mine, we built a Dash in Shiny that was basically a while (true) and Sys.sleep(5) that kept updating Dashboard data.

It would certainly be necessary to refactor the code for this new structure.

However, I do not know if I would do so today. I would probably extract and update a local database with a script dedicated only to this (probably at python, but it could be in R same) and I would run it periodically with a cron job if your O.S. is *Nix or with the Task Scheduler on Windows.

If data processing is too complex, with multiple dependencies and decisions in the process, would make an application with Make (that has a package to facilitate in the language R) or would have a local server/process with Airflow or Luigi that would only take care of data extraction and processing, and the Dash application would only connect to the data source, updating every X time or with an update button, leaving it to the user.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.