Getting started with Shiny – R web application package

Shiny is a package for building interactive web applications to visualize and play around with data without any knowledge of JavaScript or HTML.

To get started with it, we first need to install R and within the R terminal – the shiny package. I will be using Ubuntu 12.04 as my operating environment.

Installing R

For Shiny to work, R version should be >=2.15.x. The latest version of R is 3.0.0. released in April 2013. For details on the latest version, refer Upgrading to 3.0.0.

 $ sudo add-apt-repository ppa:marutter/rrutter
 $ sudo apt-get update
 $ sudo apt-get install r-base r-base-dev

For more details on installing R, refer Installing R in Ubuntu.

If you had installed R previously and have upgraded to the version provided by the PPA, you might refer Moving to 3.0.0 on Ubuntu. Also, you need to rebuilt all the installed packages. Use

 $ sudo R
 > update.packages(checkBuilt=TRUE)

The first command opens the R terminal with super user permissions required to install packages. This process will take a while depending on the number of packages installed on your R system. If any package installation returned a non-zero exit status, install it separately by

 > install.packages('package_name') 

Installing Shiny

Once R is installed/upgraded, go to the terminal and type

 > install.packages('shiny')

Checking installation success

To check installation status for the package, first close the R terminal by Ctrl+D. This is to exit the terminal with superuser permissions. Open the R terminal by simply typing R in the Ubuntu terminal. Then, run the following commands in the newly opened R terminal:

 > library(shiny)  # To include package shiny in the session
 > runExample("01_hello")  # Running the Hello Shiny Example

This should open a browser with the Hello Shiny! example –


That’s it! You have successfully installed Shiny and are now running your first application. To know more, go through the tutorial provided by RStudio (see Reference).

Shiny Tutorial
CRAN Package Shiny
RStudio IDE