From 0d93da0d89dcff7a2ae1225d7c0fc8f2eeed3cf1 Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Thu, 7 Feb 2013 16:44:46 -0600 Subject: [PATCH] Clarify global scope --- _includes/tutorial/scoping.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/tutorial/scoping.md b/_includes/tutorial/scoping.md index afb566a51..fbaf3778c 100644 --- a/_includes/tutorial/scoping.md +++ b/_includes/tutorial/scoping.md @@ -87,7 +87,7 @@ Things work this way because `server.R` is sourced when you start your Shiny app ### Global objects -Objects defined in `global.R` are similar to those defined in `server.R` outside `shinyServer()`, but there's one important difference: they are also visible to the code in `ui.R`. +Objects defined in `global.R` are similar to those defined in `server.R` outside `shinyServer()`, with one important difference: they are also visible to the code in `ui.R`. This is because they are loaded into the global environment of the R session; all R code in a Shiny app is run in the global environment or a child of it. In practice, there aren't many times where it's necessary to share variables between `server.R` and `ui.R`. The code in `ui.R` is run once, when the Shiny app is started and it generates an HTML file which is cached and sent to each web browser that connects. This may be useful for setting some shared configuration options.