Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

loading a .RData file into session but no object loaded in Shiny

Tags:

r

shiny

I got my analysis results in R (an object called obj) and save it as an .RData file obj-result.RData. Now in Shiny, at the beginning of the ui.R file, I put load("obj-results.RData") so that each time Shiny is run, this object can be loaded into R session, i.e. I expect that the obj object would be available to use in subsequent steps, such as obj@data, obj@sample, etc.

However, I find that load won't make the obj object available in current R session, so that Shiny could not find the quantities required. Is there anything I missed in loading the .RData object? Thank you so much!

like image 305
alittleboy Avatar asked Mar 23 '23 04:03

alittleboy


1 Answers

The answer is that, whenever an object is used in the ui.R and/or server.R, the relevant objects must be loaded in the same file. Otherwise, shiny won't know where to find the object from other files (even they're in the same directory and loaded).

like image 109
alittleboy Avatar answered Apr 25 '23 12:04

alittleboy