useR! 2014

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!

  • 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)
```
x <- rnorm(100)
length(x)
## [1] 100
hist(x)

plot of chunk unnamed-chunk-1

Pipeline – rmarkdown v1

Rmd to HTML Example

Pipeline – rmarkdown v1

Pipeline – rmarkdown v2

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

Add Interactivity (Shiny)

  • Not only static documents
  • Can create interactive, runnable HTML documents using Shiny

Resources