Shiny – R Based Interactive Web Application Framework
First of all, what is Shiny App? Why is it used? Where it is used? The answer is simple! Consider this scenario: A java program which calculates a square of a number. Easy to do in the command prompt or any IDE where you see the output in the console itself. But if you want a layman to enter an input and get the square of that number, you would have to create a form in HTML, take input and accordingly show the output.
Now where to start? Well, it’s simple just download RStudio which is a free open source integrated development environment for R. They also have a Rstudio community which provides packages to the R community like new features or some new APIs etc.
Shiny is one of the package by Rstudio community. You may download Rstudio from here:https://www.rstudio.com/products/rstudio/download/
Rstudio requires R 2.11.1 [just like jdk] or higher , you may download the same from here:https://cran.rstudio.com/
In Rstudio follow the below listed steps:
- File > New Project > New Directory > Shiny Web Application
- Create project as subdirectory of :Select the folder where you want your Shiny app in
- Directory name: Enter the name of your app
Once you do that, it will create a simple Shiny app which takes an input and plots a histogram using some random data. Now to run the app, first set the working directory of the folder where your ui.R and server.R are created using the commands as below:
Once you do that, install Shiny package using the command as below:
This is one time downloading of package from CRAN, later you can just load the library.
Now load the library using: library (Shiny)
and then run the app using : runApp()
And there you go. Your Shiny app is up and running!
If you are a data scientist and working in R programming language for the same, you can definitely use Shiny app for data visualization as well as presentations. Shiny also works with RMarkdown which generates reports.