loading a .RData file into session but no object loaded in 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 [email protected]
, [email protected]
, 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!
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).