How do you declare global variables in with R Shiny so that you do not need to run the same pieces of code multiple times? As a very simple example I have 2 plots that use t
As mentioned in the link that @nico lists above, you can also use the <<- classifier inside your functions to make variables accessible outside of the function.
foo <<- runif(10)
instead of
foo <- runif(10)
The link says "If the objects change, then the changed objects will be visible in every user session. But note that you would need to use the <<- assignment operator to change bigDataSet, because the <- operator only assigns values in the local environment."
I have used this to varying levels of success in shiny. As always, be careful with global variables.