Pulling data into server.R

Currently have 3 files on my server: ui.R, server.R, and data_pull.R. For some reason, these files don't work when uploaded to shinyapps.io.

data_pull.R currently from an online database (RedCap), manipulates the dataframe, and ends with

save(file = "data.Rda")

server.R starts with

server <- function(input, output){
  
  source("data_pull.R") # runs data_pull
  load("data.Rda")

}

For some reason, the app stops running after a few seconds, and I have to reconnect. My guess is (a) data.Rda isn't being saved to the correct location; or (b) I'm using the source() function incorrectly. But I don't see how.

Any help on this topic would be greatly appreciated!

What is the purpose of saving and loading a file? any object created during the execution of the sourced file is going to be available in the working environment immediately so that step seems unnecessary to me. Having said that, Have you checked in your logs if the sourced file throws an error indicating that the file wasn't created?

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.