R Markdown Tutorial

Evaluating student lab work in an in-person environment is challenging—assessing student understanding of coding in a remote learning environment is even more difficult. R Markdown may be a useful tool for you, because it allows you to evaluate code, output, and a student’s interpretation of the output within a single document.

I recently finished TA’ing a course in spatial econometrics (taught by Scott Cook) at the Essex Summer School in Social Science Data Analysis at the University of Essex. I’ve TA’ed this same course in previous summers (2018, 2019), and the coding can be challenging because it involves working with spatial data formats and unfamiliar coding structures. To account for this difficulty, Scott and I decided to have students turn in their daily practical assignments as R Markdown files. Think of it as “replicating” an in-person lab experience: you can look over someone’s shoulder to correct their coding mistakes, except that the computer screen is a static PDF file.

This R script (sample output included in the .zip) provides one easy example of how to create an R Markdown PDF file using an R script. It produces the document below. Ask students to walk through the R script to familiarize themselves with R Markdown’s structure. Then, they can edit the script’s code to create their own R Markdown files.

There are lots of ways to use the R Markdown platform, but this is the easiest way I know. If you have improvements to suggest to this tutorial, please do! There are also many more R Markdown features to take advantage of if this simple tutorial doesn’t suit your needs. More information about R Markdown is available here.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s