Overview

This group of tutorials is meant to be a brief and gentle introduction to shiny.

Fair warning: If you have experience with the shiny package or any web development, this tutorial is probably not for you. Rstudio has several more advanced topics for programming with shiny. In addition, Dean Attali has a nice curated list of shiny topics. Check out the resources page for more info.

What is this “Shiny” you speak of?

shiny is an R package by RStudio that allows for the creation of interactive “web apps”. Web apps is quoted because shiny apps need not be deployed on the web, nor do they have to be “apps” in the sense that they require some interactive/reactive content.

A shiny app written using shiny syntax is really just a wrapper around a lot of HTML, CSS, and JavaScript code. The benefit to using the shiny package as opposed to standalone HTML is two-fold: First, the shiny syntax should be (more) familiar to long-term R users, and two, it is relatively easy and plays nicely with R.

Even if you know HTML, JavaScript, or CSS, the raw power of these programming languages can easily be incorporated into a shiny application. We will see some very basic HTML code in this tutorial, but for more integration check out the page on extending shiny beyond this introduction.

Preparation

Throughout this tutorial we will be using several core packages to build each of the applications. You can check to see if you already have them downloaded, and if not install them by running the code below:

if (!require("pacman")) install.packages("pacman")
pacman::p_load(tidyverse, shiny, shinyjs)

The code checks to see if the package pacman is installed, and if not, installs it. pacman is a useful package manager/loader that quickly checks if a package is installed, installs it if need be, and then loads it.

The main packages we are going to deal with are:

Feel free to clone the whole site repo on GitHub, or download a standalone zip file with all of the necessary code.

Table of Contents

1). Hello, shiny!

2). Hello, interactive applications! - A simple user file input, summary output app

3). Hello, survey! - Creating a simple survey in shiny

3). Beyond a simple introduction

Creative Commons License