--- title: "The Next Generation of R Markdown" author: "Jeff Allen, RStudio" date: "useR! 2014" output: ioslides_presentation --- ## What is Markdown? - A "plaintext formatting syntax" - Type in plain text, render to more complex formats - One step beyond writing a `txt` file - Render to HTML, PDF, etc. ## What does it look like?
``` # Header 1 ## Header 2 Normal paragraphs of text go here. **I'm bold** [links!](http://rstudio.com) * Unordered * Lists And Tables ---- ------- Like This ```
Header 1
Header 2
Normal paragraphs of text go here. **I'm bold** [links!](http://rstudio.com) * Unordered * Lists And Tables ---- ------- Like This
## What is R Markdown?
- "Literate programming" - Embed R code in a Markdown document - Renders textual output along with graphics

``` ` ` `{r} x <- rnorm(100) length(x) hist(x) ` ` ` ```
```{r, fig.width=4, fig.height=3} x <- rnorm(100) length(x) hist(x) ```
## Pipeline -- rmarkdown v1 ![Sundown pipeline](rmd-pipeline.png) # Rmd to HTML Example ## Pipeline -- rmarkdown v1 ![Sundown pipeline](rmd-pipeline.png) ## Pipeline -- rmarkdown v2 ![Pandoc pipeline](rmd-pipeline-pandoc.png) # Rmd to Word Example ## Output Formats - Many already defined - MS Word docx - HTML - LaTeX - Can define a custom format ## Templates & Custom Formats - Predefined arrangement for a document - Can be entirely novel - Or can extend existing formats (e.g. HTML) ## Custom Template Example - Provide some scaffolding for an existing format - Add some CSS styling, images, or scaffolded content - Still just generating an (e.g.) HTML document ## Custom Format Example - Can generate Beamer (via LaTeX), reveal.js, or ioslides presentations ## Custom Format Example - Create LaTeX templates to generate structured PDFs - The `rticles` pacakge has a few interesting examples - JSS - useR! abstract - R Journal ## Add Interactivity (Shiny) - Not only static documents - Can create interactive, runnable HTML documents using Shiny ## Resources - Download the latest RStudio ([here](http://www.rstudio.com/products/rstudio/)) - File > New File > R Markdown - [http://rmarkdown.rstudio.com/](http://rmarkdown.rstudio.com/) Slides at