In presentations we often want to demonstrate R interactively. This requires exiting the presentation and demonstrating outside of the slides or running a limited (Things like install_github
can't be used), unreliable (because Internet is unreliable in presentations) cloud based version of R (as seen in the code below). How could a local version of R be run from within an HTML presentation? In a similar fashion we can use iframe
HTML tags to include videos etc. within a presentation. This could make the presentation more seamless and flow better.
I know plotting tasks are likely much more difficult and would require a specific gui such as RStudio. If that's possible it would be great but even if it were at a low level, that is include the OS command line with R booted up in the presentation. Basically it would be like iframe
-ing R from the command line or Rstudio within the .Rmd/.html document/presentation.
This would be able to be incorporated into the slidify
, knitr
as an .Rmd or within the R Presentation (.Rpres) slide shows available in the latest version of RStudio.
So here's a version of this idea using a cloud based R that could be knit as a .Rmd file. This is a starting point but being tied to a cloud is not ideal:
R in HTML
<iframe width='100%' height='300' src='http://www.r-fiddle.org/#/embed?id=e63tlTG8' allowfullscreen='allowfullscreen' frameborder='0'></iframe>
Now, it is possible create Beamer, PowerPoint, or HTML presentations, including R code, L A T E X equations, graphics, or interactive content. After the tutorial, you will be able to create R presentations on your own with R Markdown in RStudio.
To make your documents interactive, add: Htmlwidgets are R functions that return JavaScript visualizations. The document below uses a leaflet htmlwidget to create an interactive map. You can access the document here on RStudio Cloud.
In R there are a lot of packages to create interactive graphs. Highcharter is one of them, as well as the well-known HTMLwidgets. Here we have an example of a highcharter graph. We just explored the different contents and parts of our R Markdown document. Let’s see what type of output format we can obtain.
However, if you prefer that data be displayed as a PowerPoint table you can use the knitr::kable function. Table output from kable will assume the table design of whatever template you use. R code chunks can also be used to render plots. Images will be scaled automatically to fit the slide.
Speaking of Rstudio, you could simply install, on your presentation computer, the RStudio server version which runs in a browser. You can then simply use an IFRAME as you want:
<iframe width='100%' height='300' src='http://localhost:8787' frameborder='0'></iframe>
Plots and figures work exactly as in RStudio regular version.
One option is Shiny app (or even multiple apps listening on different ports) running locally on your laptop. You will need a shiny app rendering your visual(s). Shiny can run from command line R.
Primitive shiny app takes 20-30 min to master (subjective opinion) and can incorporate arbitrary complex visualization produced with R.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With