Homework 1

Psychology 2812B FW22

Weekly homework assignments are comprised of two components: a Lab Component that your TA will guide you through in the weekly lab session, and a Home Component that you are to complete on your own. You must hand in both components. Both will count towards your grade.

Submit homework on OWL by 5:00 pm London ON time on the date shown in the Class Schedule.

Submit your homework assignment as a single RMarkdown file, using your last name and the homework assignment as a filename in the following format: gribble_n.Rmd where n is the homework assignment number.

Here is the R Markdown template file for this assignment: lastname_1.Rmd.


Lab Component

1. Download the R Markdown template file

  1. Watch this video about downloading and opening the assignment template file:
  1. Download the R Markdown template file for this assignment (it is called lastname_1.Rmd and linked above)
  2. Create a directory on your computer called PSYC_2812_FW22
  3. Copy the template file into your PSYC_2812_FW22 directory
  4. Open the template file in RStudio
  5. Rename the template file using your last name e.g. gribble_1.Rmd

2. Install the tidyverse package

In RStudio, type the following into the Console and follow the prompts to install the tidyverse package:

install.packages("tidyverse")

3. Write text and code

Open your renamed template file in RStudio.

In the YAML header insert a line for the author (with your name) and a line for the date (today’s date):

---
title: "Homework 1"
subtitle: "Psychology 2812B FW22"
author: Firstname Lastname
date: January 1, 1901
output: html_document
---

In the sentence about breakfast replace with what you had for breakfast.

In the code block replace <enter the code from the assignment here> with the following (type it out, don’t copy and paste it):

ggplot(data = cars,
       mapping = aes(x = speed, y = dist)) +
  geom_point() + 
  theme_bw()

4. Knit to HTML

Select the “Knit to HTML” option in the “Knit” menu of RStudio. It should produce something that looks like this:

Knit to PDF

You can also select the “Knit to PDF” option in the “Knit” menu and you should get a PDF version of your R Markdown document. If you get an error message, try executing the following command in the Console: tinytex::install_tinytex(), and then try to “Knit to PDF” again.

5. Upload your assignment to OWL

  • upload your .Rmd file to OWL

Home Component

This week there is no home component to hand in. You only have to hand in the Lab component and upload your R Markdown file to OWL.

However—your “home component” this week is to work through the Week 2 assigned readings in advance of next week’s lecture.