Shiny – R Based Interactive Web Application Framework

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.

So what Shiny does is; it makes it simpler to make interactive Web Applications without extensive knowledge of HTML, CSS or Javascript. So it’s basically a web application framework but it’s only for R which is a programming language for statistical computing and graphics. It’s faster than Matlab and has various cool features in graphics like interactive graphs, plots. R is mostly used among statisticians and data miners for data analysis and this is where Shiny comes into picture. Instead of passing inputs and running the R script again and again, Shiny allows a cool interactive web application for data analysis and visualization in one page. Shiny can be used to give presentations and demos using its various features.

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:

Rstudio requires R 2.11.1 [just like jdk] or higher , you may download the same from here:

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.