I've created a series of R Scripts and Functions in order to obtain Baseball data from a variety of sources in order to produce a series of data.frames.
Currently, I scrape data whenever the script is run. I pull stats for the last 14 days, year to date, and last 30 days. Based on that data I have a series of filters that creates data frames based on the observations.
I'd like there to be a dropdown on the sidebar panel to choose the timeframe requested. Either Year to Date, last 14 days, or last 30 days.
Basically something similar to the attached website: https://www.fangraphs.com/leaders.aspx?pos=all&stats=pit&lg=all&qual=y&type=8&season=2018&month=0&season1=2018&ind=0
This is the website I currently scrape from.
Is there a best practice for preventing Shiny to have to query the website every time leading to a lag when choosing different timeframes? One idea I thought of would be to run the functions using an Automator and then having Shiny connect to the .rds files left behind.
Any advice would be greatly appreciated.