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

global.R coding


While the previous section covered processes that had to be done only once whenever the data source changes, global.R will include all the actions that can be done just once per session, for example, see the following:

  • Data source loading

  • Library calls

  • Custom functions sourcing

In our case, apart from loading the dataset and calling the corresponding libraries, we will need to generate a vector that contains the names of all the categorical variables. This will be used in one of the variables selectors. Of course, this last step can be avoided and the list of variables can be hardcoded.

However, in terms of the application's maintenance, it is much wiser to do it this way because if the data source changes (for example, a new categorical variable is added) and we want to include this in the same way as the others, we should be constantly updating this list manually. Although this might be trivial in this example, it can be very necessary in others, especially when the data source...