For each assignment, as well as for the project, you need to hand in a .pdf report. This report should be a written response to the tasks given in the assignment. It should respond to all the questions in the assignment in a clear and succinct manner.

1 Workflow: Two Approaches

There are two approaches you can take when you write your report. The first of these is to use R Markdown; the second is to write your report in a WYSIWYG (what you see is what you get) software such as Libre Office, Google Docs, or Microsoft Word.

1.1 R Markdown

R Markdown represents a way to write reproducible reports that can be rendered in a wide variety of formats and which allows you to interleave R code with text.

Pros:

  • You don’t need to bother with formatting details. R Markdown, pandoc, and LaTeX takes care of it all for you.
  • It’s very convenient to modify figures or change image sizes. (Simply change fig.width and fig.height in the header).
  • Code that you include is automatically formatted and receives pretty syntax highlighting.
  • Your document becomes reproducible by someone else if you just give them the .Rmd file (and sometimes some other additional auxiliary files). You are even encouraged to submit your R Markdown file along with your submission for the assignments and project, so that your peers can reproduce your work (if they are interested in doing so).

Cons:

  • You need to learn Markdown syntax and R Markdown code chunks, which will require an initial time investment. If you don’t expect to write these kinds of reports or presentations in the future or will be working with people who will not use R Markdown, this investment may not pay off.
  • There are sometimes technical difficulties in getting R Markdown working, especially for Windows machines1.

1.1.1 Getting Started with R Markdown

To get you going with R Markdown, we have prepared an introduction that you can read here.

1.2 Template

We have provided an R Markdown template that we want you to use if you use R Markdown. Download it to template.Rmd in your working directory by calling the following lines of code.

download.file(
  "https://raw.githubusercontent.com/stat-lu/dataviz/main/resources/template.Rmd",
  "template.Rmd", # filename for the file (which you can replace if you want)
  mode = "wb"
)

2 WYSIWYG Editors (Office Packages)

If you prefer to use a WYSIWYG editor, please see the Figure Sizing section in the text on figure formatting for information on how to export and size your figures appropriately.

2.1 Pros

  • You probably already are familiar with Microsoft Word or Google Docs, so you can get going quickly.

2.2 Cons

  • Modifying figures is a little bit of a hassle since you need to re-import the figure every time you modify the plot or make changes to its size.
  • When you want (or need) to include code, you need to format it yourself by using a mono-spaced font (such as Courier or Consolas), and will not get syntax highlighting.

3 Detailed Requirements

3.1 Submissions

You need to submit a PDF with your work. If you’d like to, however, you are also free to include .Rmd and .R files with your submissions containing code to reproduce your work. Doing so, however, is not at all obligatory.

3.2 Writing

Your report does not need to be verbose but it must be clear and coherent. Use full sentences and describe the steps you take and code you’ve included. Use a walk-through approach, where you guide the reader through the report. Someone who has not seen the assignment instructions but with the same background as you should be able to read and follow along reasonably well. Do not use a question: answer format in your report.

3.3 Figures

Please see Formatting Figures for detailed information about formatting figures.

3.4 Code

You only need to include code when you are explicitly instructed to do so. When you do include code, please avoid having it escape into the margin by using multiple lines to separate code. Good code style is not a requirement in this course but is nevertheless good practice. It might be a good idea to conform to a style guide such as the tidyverse style guide.

If you want to format code automatically, we suggest you install the styler package. After installing the package, you can click on Addins in the toolbar in R Studio followed by Style active file (under the Styler header) to format the current file using the tidyverse style.

4 Peer Review and Examination

For each assignment you will need to peer review three other reports. To complete these reviews, you need to fill out the rubric associated with the assignment and add a general comment on the submission. In addition, we also encourage you to provide annotated feedback using the integrated tools in Canvas. Please see this page to read more about peer-reviewing in canvas.

Finally, please remember to provide constructive feedback.

4.1 Grading

The assignments and project will be graded by an instructor or teaching assistant as pass or fail. To pass the course, you need to pass each assignment. If you fail any assignment (or the project), you will get an additional chance to hand in these after the conclusion of the course.

5 Hints

  • Functions in the tidyverse are well-documented. Students who are successful at these assignments often make good use of the help files for the various functions. (In R Studio simply place the cursor on the function name and hit F1).
  • To run code in R Studio inside a R Markdown document, highlight the code and hit Ctrl/Cmd + Enter. (There is no need to copy it directly into the terminal.)
  • To create a code chunk in your R Markdown document, use the shortcut `Ctrl/Cmd
    • Alt + i`.
  • If you want code in your R Markdown document to appear inside your final report, use echo = TRUE in the header of the code chunk.
  • The size of figures can be controlled using the fig.width and fig.height options in the code header (if you use R Markdown) and the width and height arguments in ggsave() if you use a WYSIWYG editor. Please don’t resize the images inside the editor, which will risk making the annotation in the visualization hard to read.

  1. This is typically not a problem since you can export your document to a Word document instead of a PDF.↩︎