1. Introduction to Shiny
Welcome to "Building Web Applications in R with Shiny". I'm Ramnath Vaidyanathan, VP of Product Research at DataCamp, and will be one of your instructors.
In this course, you will learn how to turn your R code and data analyses into awesome web applications using Shiny.
2. Introduction to Shiny
Shiny is an R package that allows you to turn your analyses into interactive and engaging web applications without leaving the comfort of R!
By the end of this course, you will be able to build real-world Shiny apps, like this one, a simple app that allows the user to interactively visualize a histogram of waiting times of the hot spring Old Faithful by changing the number of bins.
You can write this app in less than 10 lines of code.
3. What is a web app?
It is important to understand what a web application is. These days, almost everything you encounter on the internet is a web application.
All web applications have a user interface that you can interact with. Based on those interactions, the app updates the display in the server to provide you with relevant information and plots.
Here are two examples.
4. What is a web app?
The first is from the New York Times and helps users visualize the impact of different election results on the outcome. It's one of my all-time favorite web visualizations.
5. What is a web app?
The second is the DataCamp mobile app. You are presented with a practice question and a series of choices, from which you need to select the correct one. The app then checks your answer and provides appropriate feedback.
6. How does a web app work?
Most web apps have two parts:
A client or user-interface that users interact with, and a server or backend that carries out computations or searches based on the user interactions.
For example, when you use tax software to file your taxes, the user interface is where you enter information from your W2 and other tax forms. Based on the values you enter, the server calculates your tax liabilities and updates the refund amount displayed to you.
7. What is Shiny?
Shiny is an R package that allows you to write web applications with R. The client (user-interface) as well as the server (backend logic) are written using R code.
You might ask me: "I'm a data scientist, not a web developer. Why should I build a fancy web application? Why can't I have a web developer build it?"
Let me try to convince you to do it yourself with an example scenario.
8. Why should data scientists build web apps?
Suppose you've been asked to run a cluster analysis on the iris dataset. Your finished product is a plot of clusters visualized as a scatterplot.
Your manager tells you: "This is interesting, but have you considered four clusters? Or two? Can I see how the clusters look for a different set of X and Y axes?"
9. Why should data scientists build web apps?
You might have already anticipated some of these questions and turned your code into a function where you plug in the number of clusters, plus the x and y variables as parameters.
Now, you can tell your manager: "No problem! Give me 15 minutes."
Though an improvement, creating multiple plots with this function is a far cry from the exciting work you did to cluster the data in the first place.
10. Why should data scientists build web apps?
With only a small amount more Shiny code, you can turn your function into a web-application that lets your manager interactively update the parameters and explore the results of the analysis himself or herself.
11. Why should data scientists build web apps?
This is why you should learn to build web-apps!
Shiny not only helps you create web-apps, it helps you build apps that are visually gorgeous.
12. Let's practice!
Let's go test your Shiny knowledge.