install.packages("tidyverse")
Homework 0
Psychology 2812B FW23
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_0.Rmd.
1. Download the R Markdown template file
- Watch this video about downloading and opening the assignment template file:
- Download the R Markdown template file for this assignment (it is called
lastname_0.Rmd
and linked above) - Create a directory on your computer called
PSYC_2812_FW23
- Copy the template file into your
PSYC_2812_FW23
directory - Open the template file in RStudio
- Rename the template file using your last name e.g.
gribble_0.Rmd
2. Install the tidyverse
package
In RStudio, type the following into the Console and follow the prompts to install the tidyverse
package:
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 0"
subtitle: "Psychology 2812B FW23"
author: Firstname Lastname
date: January 1, 1901
output: html_document
---
In the sentence about breakfast replace
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
RStudio can convert your R Markdown file into an HTML file. This is called “knitting” the file. It is a nice way to visualize the output of your code and text together in a human readable, single document.
Select the “Knit to HTML” option in the “Knit” menu of RStudio. It should produce something that looks like this:
RStudio can also “knit to PDF” and “knit to Word”, feel free to experiment with those if you wish.
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