Background

We assume that students in enrolled in this course have at least some experience using R via R Studio and in particular, using R Markdown. For those with more limited knowledge, it may be useful to brush up via the videos and additional readings below.

The videos below were created for the DATA 550 course at Emory University RSPH and are reproduced here out of context of that course. Thus, there may be some irrelevant or nonsensical commentary related to other contents of that course. Nevertheless, we hope that these videos are useful for you in preparing for the short course.

Review of R Markdown

What is R Markdown?

In this video, we describe:

  • the motivation for R Markdown
  • the installation process for rmarkdown package and its dependencies
  • opening an R Markdown document in R Studio

Anatomy of an R Markdown document

In this video, we describe:

  • what elements can be included in an R Markdown document

Introduction to yaml and markdown

In this video, we describe:

  • the yaml header of an R Markdown document
  • basics of markdown syntax
  • how to render R Markdown documents in R Studio

Adding R code to documents

In this video, we describe:

  • adding R code chunks to R Markdown documents
  • adding inline R code to R Markdown documents

The video references the “VRC01” data set, which is not described in previous videos. There is no real need to understand scientifically the contents of these data. They are simply an example to illustrate some of the features of R Markdown.

Rendering pdf documents

In this video, we describe:

  • how to install tinytex to render pdf documents in R Markdown

This video is not strictly necessary for the course, but may be helpful for using R Markdown in the future. If you already have a working latex installation, then you can ignore this video.

Customizing the yaml header

In this video, we describe:

  • customizing output of document via modification of the yaml header
  • including inline R expressions in the header

latex and html in documents

In this video, we describe:

  • how to include latex and html in R Mardown documents when rendering to pdf
  • how various output formats handle these languages when rendering documents

As with the previous video, this is not strictly necessary for this course, but may be useful if you like to look at pdf outputs.

Code chunk options

In this video, we describe:

  • how to control output formatting via code chunk options
  • the various syntaxes available for specifying code chunk options
  • the echo and include options
  • brief overview of other common code chunk options

rmarkdown: under the hood

In this video, we describe:

  • the interplay of rmarkdown, knitr, and pandoc in creating output

Debugging errors in R Markdown

In this video, we describe:

  • the difference between the interactive R console in R studio and an R Markdown document
  • demonstrating the order of operations when rendering R Markdown documents
  • strategies for figuring out where errors are occurring in a document

This video is not strictly necessary for the course, but may be helpful in using R Markdown.