Book Image

Learning Shiny

By : Hernan Resnizky
Book Image

Learning Shiny

By: Hernan Resnizky

Overview of this book

Table of Contents (19 chapters)
Learning Shiny
Credits
About the Author
Acknowledgements
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Introducing R, RStudio, and Shiny
Index

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.