R + Shiny which hammer? straight Shiny, flexdashboard or shinydashboard?

micstr picture micstr · Jun 23, 2016 · Viewed 10.3k times · Source

At the risk of getting hit with a mods "too broad a question" hammer, I want to ask given the plethora of interactive R Shiny tools and packages emerging, when do you use which one?

  1. Shiny - to me only downside your project needs to run from shiny server but seems the best choice.

  2. shinydashboard - Shiny but has nice Value boxes for callouts.

  3. flexdashboard - write it up in Rmd. What does that gain you that straight Shiny does not? Perhaps, useful to email to a client provided you are happy to pass over data? I have been playing around with flexdashboard but its inability to work with datatable (library(DT)) makes me feel like it needs a few more iterations.

Looking at other answers, I am not alone in asking this question.

The creators are providing lots of galleries out there to showcase their packages/approach, but how do you know which path to go on?

What are the clear advantages of using one over the other?

Answer

Amit Kohli picture Amit Kohli · Oct 3, 2016

There's one nuance that needs to be made. Interactivity does not necessarily require a server behind it running code. Interactivity can be provided using embedded JavaScript, which would execute at the client-side (like plotly, highcharts, leaflet etc). So if we don't use the word "interactivity", but describe the interactivity explicitly, then your options become:

  • Shiny: Needs a server behind it to execute R code on user input. Can implement any layout. Can run interactive code either by processing serverside (in R) or clientside (in embedded JavaScript).
  • shinydashboard:Needs a server behind it to execute R code on user input. Can implement a dashboard layout. Contains some specific widgets designed to work in a dashboard layout. Can run interactive code either by processing serverside (in R) or clientside (in embedded JavaScript).
  • flexdashboard: Just a document that looks like a dashboard. Also contains some specific widgets designed to work in a dashboard layout. Can only run interactive code clientside (in embedded JavaScript).

So basically, if whatever interactivity is required can be offered by an existing package (that uses htmlwidgets), then you can just use flexdashboard and you don't need to deploy it to any Shiny server. Otherwise, you do need to deploy to a Shiny server and you should use either Shiny, or shinydashboard.