Creating Shiny Apps at the SSCC
1 Introduction to Shiny
This book will teach you how to create a Shiny app from start to finish.
Shiny apps are web applications that combine the interactivity of the web with the computational power of R. They allow visitors to your website to execute select R commands and view the results without knowing any R themselves.
Take this simple app as an example: example1
(Note that showing the code alongside the app is optional.)
The drop-down menu has two options, “wt” and “hp”. Whichever one is chosen, that variable will be the x-axis in a plot where “mpg” is the y-axis. What this app does, then, is allow the user to choose among two lines of code, without the requirement that the user knows any R:
plot(mtcars$wt, mtcars$mpg) plot(mtcars$hp, mtcars$mpg)
With more user inputs, the possible outputs increase in number, all without placing the burden of programming on the user.
The goal of this article is for you to build your own Shiny app that allows app users to visualize and calculate summary statistics from a dataset. The examples in this article were created with this goal in mind.
The chapters end with one or both of two types of exercises: “Check Your Understanding” and “Create Your Own App”. The “Check Your Understanding” exercises will test your understanding of the material covered in the chapter by answering questions or modifying a Shiny app. The “Create Your Own App” exercises will give you the opportunity to build and publish your own Shiny app.