Updating data used by a shinyapp

Viewed 53

I have a relatively simple problem. I want to build a shiny app (and publish it via shinyapps.io) that loads a csv file which is updated daily. Since it takes quite a lot of time to update the data (around 30 min, I am retriving some twitter data using rtweet) I would like to run a separate script (update_data.R) every day that would update the my_data.csv file (which is loaded in the shiny server function) so that the app is not interrupted.

What is the easiest way to update the csv file daily without interrupting the app? Many thanks in advance!

1 Answers

Suggested Deployment: (Daily Database Renewal)

library(rtweet)
library(cachem)
library(shiny)
library(cronR)

If you are hosting locally,

  1. Have your shinyapps.io website spin up and be online when you make rtweet queries to scrape data, collect infor and store as an R object in your env.
  2. Use cachem to create a cache in mem/disk (depending on size of df returned/amount of info wanting to store)
  3. Refer to this maxAge = 86400 created cache to keep your rtweet data and perform word cloud analysis on these datasets
  4. Enjoy your published data pipeline!
Related