Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This allows the presenter to write and execute R code within the presentation without going back and forth between the presentation and the R console.
---
title: "Interactive Presentations"
author: "Mikhail Popov (@bearloga)"
date: "December 4, 2015"
output: ioslides_presentation
runtime: shiny
---
## Reduce Demo
`Reduce` uses a binary function to successively combine the elements of a given vector and a possibly given initial value.
```{r}
A <- month.name[2:6] # February, March, April, May, June
B <- month.name[4:10] # April, May, June, July, August, September, October
C <- month.name[3*(1:4)] # March, June, September, December
D <- month.name[2*(1:6)] # February, April, June, August, October, December
```
```{r, echo=FALSE}
inputPanel(
tags$textarea(id = "ex3", rows = 3, cols = 40,
style = "width:700px;font-size:24px;",
'intersect(intersect(intersect(A,B),C),D)')
)
renderPrint({
eval(parse(text = input$ex3))
})
```
<!-- When presenting, replace code in text area with: Reduce(intersect, list(A,B,C,D)) -->
@bearloga
Copy link
Author

bearloga commented Dec 4, 2015

When presenting, replace code in text area with: Reduce(intersect, list(A,B,C,D))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment