Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include interactive local R in presentation

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>
like image 855
Tyler Rinker Avatar asked Dec 14 '13 16:12

Tyler Rinker


People also ask

Is it possible to create a presentation in R?

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.

How do I Make my Documents Interactive in R?

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.

How to make an interactive graph in R?

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.

How to display a plot in PowerPoint using R?

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.


2 Answers

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.

like image 157
damienfrancois Avatar answered Oct 15 '22 08:10

damienfrancois


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.

like image 43
topchef Avatar answered Oct 15 '22 08:10

topchef