O'Reilly logo

Learning Shiny by Hernán G. Resnizky

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

An introduction to global.R

global.R is a script that is executed before the application launch. For this reason, it can include the same pieces of code to execute the reactive independent processes as previously explained, but it also has an additional capability: the objects generated in global.R can be used both in server.R and UI.R.

Back to our example, imagine that the dataset that is being used changes after a certain time, and rows with certain species are added and removed. In this case, it would be more appropriate that the options in the species selector defined in UI.R are not hard coded but are defined dynamically based upon the Species variable in the dataset, as shown in Example 4 – using global.R.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required