Overview

This is a simple homework assignment template using R Markdown.

  • R Markdown is a convenient way of writing reports which includes R code and the code’s automatically-generated output.
  • To learn how to use R Markdown, see the References & Further Reading below in this document.
  • You will write your homework following the structure provided in this template.

1. “PROBLEM NUMBER ONE”

Notice that in the previous line we can create a header for our problem number by using a single “#”. The text is then automatically bolded and indented. Below we will create a sublist. This should be used if problems have more than one part.

a. “PROBLEM NUMBER ONE, PART A Answer”

b.

c.

d.

2. “PROBLEM NUMBER TWO”

Suppose we need to input an R chunk into our homework file. In this case, the following syntax should be used. Note that “’’’” signifies we are include chunks of code (We may also tweak the options as necessary). In this template, all the code chunks are folded (by default), you can change the look by changing the code_folding parameter (at the beginning of the *.Rmd) or clicking the fold/unfold button (at the top of the *.html).

# input R code here. Examples: define R list
x = c(1, 2, 3, 4, 5)
# make plot
plot(x)

Below the R code, we can provide additional descriptions and/or explain our code more thoroughly.

3. “AND REPEAT….”

# again, we can input our R code here.

References & Further Reading

Acknowledgments

This document was adopted from several good resources: Prof. Debdeep Pati’s homework template, Prof. Nathan Taback’s Using R Markdown for Class Assignments (which was adopted from Cozma Shalizi’s guide).