Add a shinyApp to a presentation

Keyboard Shortcuts

Shiny content can be embedded into RMarkdown presentations and reports, through the use of the shinyApp function. The shinyApp function consists of two named arguments - ui and server which define client-side and server-side content, respectively. The server argument defines a function dependent on input and output variables; input variables are in controllers (typically in the ui argument) and output objects are defined in the server argument, these are generated using render* functions and then displayed in the ui with *output functions. This video tutorial introduces the basic structure of the shinyApp function and how to use it to embed interactive content into your RMarkdown presentations.

- [Voiceover] Let's add a simple ShinyApp to an…R mark down presentation file.…Let's go over to RStudio…and let's open up the exercise for this video.…So we'll open up the project by…going to the top right-hand corner of RStudio,…selecting open project,…navigating to the desktop,…the exercise files,…and 04_02 and choosing that project.…Inside of that project, we've got two R mark down files…that begin in and end state…and we're going to open both of those.…

We start with the begin file and what we're gonna do…in this R mark down presentation is visualize a curve.…So if I scroll down in a presentation to line 14,…we can see a code chunk called curve static.…This is the expression that I want to make interactive.…If I just evaluate line 15 briefly,…we can see how this expression will look.…And what we want to do is build a ShinyApp…which allows us to change the exponent here.…

In order to do that, we need to use the ShinyApp function.…If we scroll down to line 23,…we can see our code chunk called curve shiny.…You can see line 24 while loading the shiny library.…

Resume Transcript Auto-Scroll

Author

Released

4/29/2016

Analyzing big data is great, but not if you can't share your results. In this course, Martin Hadley shows how to create interactive presentations of large data sets with R, RStudio, and Shiny, an R-based tool for producing interactive, web-ready data visualizations. Learn why these tools are important to data scientists, how to configure and install them, and how to use them to make your findings more clear and engaging.

Discover the different types of presentations you can make right out of the box with R Markdown templates (built right into RStudio) and how to customize the templates with CSS. Find out how to register for RPubs to deploy RStudio presentations for sharing, and then go beyond the basics with Shiny—adding interactivity and creating embeddable dashboards without the need for HTML or JavaScript.

This is an exciting course for analysts who want to increase the relevance and visibility of their work. Make sure to watch the knowledge checks at the end of each chapter to test your new skills.