Sometimes Displayr documents can be sped up by pre-computing results and storing the results in the Displayr Cloud Drive. When the results are needed, they are retrieved from the Displayr Cloud Drive, rather than being calculated from scratch.
This example extends the example in Run Slow Data Queries, Calculations, and Extracts When Users Aren't Using a Document.
The code below extracts stock price data for Microsoft at 1AM New York time and then saves it to the Displayr Cloud Drive.
data <- new.env()
env = data,
from = seq(as.Date(Sys.Date()), length = 2, by = "-5 years"),
to = Sys.Date(),
auto.assign = TRUE))
all.data <- data[[ls(data)]]
stock.prices <- data.frame(all.data)
us.format = TRUE,
time.zone = "America/New_York",
units = "days",
frequency = 1,
options = "wakeup")
"Exporting data to cloud drive every day" # This is a comment so that the calculation is visible