Chapter 6

This section contains further exercises and examples of using Shiny.

The Reactive data lesson looks at a better way of handling the data we plot on the graph, so we can use it more than once. Reactivity is an important concept in Shiny. We also cover some tips for debugging your Shiny apps in this section.

The interacting with graphs lesson looks at how we can use reactivity and events to get more information about a country when we click its point on the graph. You should complete the reactive data lesson before this lesson.

The layout lesson looks at changing the layout of the user interface. It doesn’t have any dependencies besides the first part of the workshop.

In this course we’ve limited our outputs to graphs and text. Although we don’t cover it here, you can add other output types, such as leaflet maps, plotly graphs, and network diagrams. These almost invariably follow the same approach; render...() defines the output in the server function, and a ...Output() function displays it in the user interface.

Going further

There are a number of online tutorials on Shiny. RStudio provide a page which contains links to many of them. The tutorial by Dean Attali is very good.

Deploying your own server

We covered publishing your app on shinyapps.io in the deployment section. If you want to host your own apps, you can do this using Shiny Server. This comes in open source and commercial flavours.

Installation on most common Linux platforms is usually straightforward. If you’re comfortable using Docker the Rocker project’s Docker image is even easier to deploy.

Shinyproxy lets you apply authentication, and improve the scalability of your apps using docker-(swarm) or Kubernates, using the open source version of Shiny server.