3

I have a data source that needs to be loaded once and so read the data source into the global environment. I put it in the global environment because the ui.r file needs to access it to take the unique values of some columns to create dropdowns on the ui.

so my global.r has this:

############## global.r file
read.csv("mydatasource")

My issue is the csv file take about 2 minutes to load so I would like to add a progress bar.

Is it possible to out a withProgress in the global.r file?

Also - will the csv be reloaded each time someone comes to the URL?

OR will it only be loaded once which would make the UI faster when someone comes to the URL?

....if it loaded every time is there a way to make it load only once so when a person comes to the URL they don't have to wait?

5
  • If you want the unique values in dropdowns in the UI you can load the data in server and then create the dropdowns with renderUI, so you can get withProgress to work since it is in server
    – Carl
    Aug 19, 2016 at 18:20
  • 1
    Each time someone goes to your URL it initiates a new instance of R, which will have to reload the CSV, so yes the CSV will be reloaded.
    – Carl
    Aug 19, 2016 at 18:21
  • If you don't want to reload the csv each time you could save it as an .Rda instead
    – Carl
    Aug 19, 2016 at 18:25
  • @Carl is there a way in R to do make a csv file an RDA automatically? Currenlty I have an R script that write the data to a csv file like write.csv(data,mypathofsite) How would I write it to a .RDa file? and then how would I read the data out of the RDA? currently i am using read.csv() ...I just can't create the RDA manually... Thank you Aug 19, 2016 at 20:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.