Learning objectives

  • Understanding dynamic document types
  • Learning basics of Markdown and RMarkdown
  • A brief introduction to the many options
    • Dynamic web based content (i.e., flexdashboards)
    • Static rendering to pdf, word, or html
    • The many templates that exist already

Basic RMarkdown Documents (.Rmd)

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

There are loads of options within these .Rmd files, all largely based around how you format the yaml header within these documents. Much of this has been designed to make it easy to setup/customize as much or as little as you are interested in.

yaml

Basic Markdown Lingo

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

Including Photos from Web

Including Image from Your Computer

Using flexdashboards

These are very cool documents that are sort of like interactive and dynamic webpages. You can provide a number of different panels (customized as you like), which can display data in an interactive and exploratory way.

Creating your own CV

With just one added file (a template), and installing a program called LaTeX, it is possible to maintain/update your CV using RStudio and RMarkdown. Some folks have even developed templates for manuscripts and dissertations using this method! What follows is an adaptation from Steven Miller’s excellent post and associated code with a few formatting changes.

The following lesson/showcase will require 3 pieces:

  • Folks need to have a version of LaTeX installed, and it can take awhile, so if you don’t already have it downloaded, please do so ahead of time if possible (here: http://www.latex-project.org/get/)
  • You’ll need the rap-latex-cv.tex file (the template that dictates how the PDF will look), you can download from here

  • And you’ll need the actual template-2pg-cv.Rmd file, here.

Important tips:

  • Use a new RStudio project for this (and everything, it makes things easier)
  • Make sure you have a LaTex distribution installed (see here, note: it is a big file and will take a little time to install the first time)
  • Make sure in your RStudio global settings you have pdfLaTex selected in the Sweave options (see here for more info on checking this).

CV Example

Here’s an example PDF