Scope of global.R

114 Views Asked by At

I think of the global.R file as a file that is being run once before app starts. That means we can use it for all sorts of data processing, running models, and, of course, to load in your data. In global.R I am creating vector of random values. Locally when I refresh my web page it returns the same random values which makes sense as global.R runs once. I want to understand how it would work in docker containers using shinyproxy. Docker creates separate container for each user. Would it mean different random values of global.R shown for each users every-time (till container is closed)? And refreshing the web page (hosted in docker) means separate container? Note : I don't want to set seed. I need randomization only

1

There are 1 best solutions below

0
On

I think you'd need to explicitly set you seed otherwise (from the docs):

Initially, there is no seed; a new one is created from the current time and the process ID when one is required.