Introduction to RMarkdown


I use R Markdown in my classes to have students submit their homeworks (problem sets) as PDFs.

In order to use Markdown to compile PDFs, you need to download TeX to your computer (unless you are using

Follow this tutorial to download the proper software:

• Mac users:

• Windows users:*

WINDOWS USERS: If you install MikTex using Chrome, select "Yes" instead of the default "Ask-Me-First" option to the question of whether LaTex can install missing packages on the go.

This lesson makes the most sense for students using Markdown for homework assignments. Before running through this lesson with students, I have them complete the following assignment first. This assignment serves two important purposes: 1) It helps troubleshoot any knitting errors, which are extremely common when first introducing students to TeX (used to compile Markdown PDFs), 2) It models how to create an RMarkdown file from scratch.

Assignment (complete before R Markdown Tutorial):

Create a test R Markdown document by following these steps::

After downloading R, RStudio, and TeX, open the RStudio application. Click the "new page" icon in the top left corner of the screen; it looks like a blank white page with a green plus sign. Select "RMarkdown..." In the box that pops up, type "Test" in Title, your netID in Author, and select PDF. Click the "Knit" icon in the top pane. It has a ball of blue thread next to it. A "Save As" box will pop up. Save your file as "Test" and select a location on your computer to save it to. Check this location for your PDF and look over the document before submitting it under Assignments on Canvas.

RMarkdown file for the following lesson: RMarkdownDemo.Rmd