6

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>
Tyler Rinker
  • 108,132
  • 65
  • 322
  • 519
  • 1
    Put R on a memory stick. – IRTFM Dec 14 '13 at 16:37
  • Embed http://www.r-fiddle.org/ as an iframe. – Thomas Dec 14 '13 at 16:37
  • @Thomas I had thought of that and updated just before you commented, but the local version is ideal for presentations. – Tyler Rinker Dec 14 '13 at 16:38
  • 2
    I think the right way to think about this is not as an R-specific solution, but rather how to get a shell into a presentation. These tex posts ([1](http://tex.stackexchange.com/questions/125317/embed-a-terminal-command-in-a-beamer-presentation), [2](http://tex.stackexchange.com/questions/22960/a-button-that-runs-an-external-program-from-a-beamer-pdf-presentation?lq=1)) look like they have some decent ideas, as does [this superuser post](http://superuser.com/questions/473700/how-to-embed-a-shell-and-browser-into-a-presentation). – Thomas Dec 14 '13 at 17:00
  • 1
    This can be done with Slidify. See this [blog post](http://slidify.github.io/interactive/). It uses Shiny when run locally, and switches to OpenCPU when posted online (the OpenCPU binding is broken currently due to the update in OpenCPU). – Ramnath Dec 14 '13 at 21:26

2 Answers2

3

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.

damienfrancois
  • 52,978
  • 9
  • 96
  • 110
2

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.

topchef
  • 19,091
  • 9
  • 63
  • 102