The previous recipe taught you how to install and load shiny
, as well the basics of crafting and running a shiny
app. This one introduces how to draw a basic interactive shiny
plot (it's actually a shiny
web app though). To do that, we shall demonstrate how to manipulate input and output while also taking advantage of plotly
's interactivity.
Besides shiny
, we also need three more packages, as follows:
> if(!require(plotly)){install.packages('plotly')} > if(!require(Ecdat)){install.packages('Ecdat')} > if(!require(dplyr)){install.packages('dplyr')}
The plotly
package will be used to draw the plots, Ecdat
will land the data, and dplyr
will manipulate it. The data frame to be used is called USGDPpresidents
and displays information about the Real Gross Domestic Product (real GDP) inflation index, presidents, wars, and more.