Assignment 3/4: ggplot2
Description
This is a double assignment, replacing the two assignments I had scheduled for February 19 and February 26. It is due March 5.
Document Setup
For this assignment, create an HTML document using Quarto. You can refer to the homepage.qmd document we created in class for some ideas.
- Make sure your YAML header has:
- The option
embed-resources: true- This goes under the html: format option.
- It will make sure the HTML file stands alone, rather than referring to an external figure. I won’t be able to see your figure if you upload and HTML file without this option.
- The option
- I want to see the code chunks that create your figure, so make sure you use
#| echo: truein your R code chunk.- You may use code folding (
#| code-fold: true) if you’d like.
- You may use code folding (
The purpose of this assignment is gain some familiarity creating data visualizations using ggplot2. You can refer to the script we wrote in class for some ideas, which will be posted on the Code page.
Instructions
- Find a dataset.
- Write a small amount of narrative in your Quarto document about the dataset and why you want to make a particular visualization. Don’t spend a lot of time on the narrative.
- Create at least two figures:
- For at least one of them, pipe (
%>%or|>) the data toggplot()after manipulating thedata.frame. - Use two different idioms for the two figures. For example, a scatter plot and a bar chart. You can refer to Lecture 10 for ideas on which idioms to use. Explain in the narrative why you chose that idiom for this visualization.
- Each figure should use at least 3 channels (e.g., x-axis, y-axis, color/shape/size). Make sure the figure has a legend!
Let me know if you have any questions!