
Module 2 Assignment
This assignment will be due on Tuesday, October 13, 2026 at 11:59pm.
Introduction
This is your assignment for Module 2, focused on the material you learned in the lectures and recitation activities on R Markdown, wrangling, ggplot101, and ggplot102. This assignment is worth 8 points.
Submission info: you will submit this assignment by uploading a knitted .html to Carmen that you created from an R Markdown or Quarto document.
- Make sure you include the
Code Downloadbutton or another way to download your code - Show your code within your knitted
.html - Customize the YAML and the document so you like how your final report looks - do check this before you submit
- All code should be annotated (meaning, you should be writing descriptions in your own words about what the code is doing)
- All decisions should be described in the text of your document
Please remember that you can use generative AI to help with your coding, but it should NOT be used to generate your assignment text or on conceptual questions. You should be able to explain your code and your decisions in your own words. If you use generative AI for your code, please cite:
- what the goal of the use was
- your prompt
- what you got
- what edits you made
Why are you doing this?
The purpose of this assignment is to demonstrate that you are able to:
- Look at data and choose a suitable chart type for that data
- Use R and R Markdown/quarto to create a visualization that executes on your decisions in #1.
1. Provide feedback to improve an existing figure (2 points)
One of your lab mates presents the figure below in lab meeting and it is your job to give them constructive feedback how to improve this figure to best communicate the data. The data below shows the yield of different peppers for 20 different genotypes under two different treatments, where water is limited or not limited. The different colors represent the different categories of peppers, those that are collected that are green (this is the color they should be), those that are red (this is another color they should be), those that are rotten (this is bad) and those that are unmarketable (those are also not desirable). Your main question is to understand how pepper genotypes perform under the two different water conditions.
Provide 4 things you could try to improve this figure and describe why each would be an improvement over the current version.
2. Creating tidy data (2 points)
You are presented with data collected with yield data over 5 years that looks like this:
| location | 2022 | 2023 | 2024 | 2025 | 2026 |
|---|---|---|---|---|---|
| Ohio | 53 | 11 | 2 | 93 | 40 |
| California | 50 | 29 | 4 | 40 | 53 |
| New York | 19 | 83 | 62 | 20 | 61 |
| Florida | 70 | 95 | 47 | 94 | 7 |
| Texas | 84 | 53 | 90 | 83 | 70 |
| Virginia | 76 | 96 | 79 | 83 | 15 |
You can download this data using this code for question 2c.
# on a Mac/Linux
download.file("https://github.com/jcooperstone/jcooperstone.github.io/raw/refs/heads/main/assignments/modules/module2/yield-year.xlsx",
destfile = "yield-year.xlsx")
# on a Windows machine
download.file("https://github.com/jcooperstone/jcooperstone.github.io/raw/refs/heads/main/assignments/modules/module2/yield-year.xlsx",
destfile = "yield-year.xlsx",
mode = "wb")a. Describe in words what it means for data to be in a tidy format
b. Describe in words how you would convert the dataframe above to be in a tidy format
c. Provide code for how you could convert this data to be in a tidy format
3. Select the right plot for a dataset (2 points)
I am going to describe different types of data, and Iβd like you to share:
- what type of question you would be asking with this data
- what type of plot would be best to visualize it
- why you picked that visualization
- how you would code that plot in words (but you donβt actually need to code it)
You do not need to actually create the plot.
a. The height and weight of a sample of 10,000 people from Ohio
b. The expression level of 3 genes in treatment (n = 10) and control (n = 10) samples
c. The number of students in Ohio who got a PhD per year from 1950 until now
d. The amount of time spent studying and the grade achieved on the organic chemistry final for 200 students at Ohio State.
4. Recreate the following plot (2 points)
Recreate the following plot (as close as you can) which compiles the total number of PhDs awarded across different broad disciplines from 2008 to 2017. You can find the data here: Number of PhDs awarded in the United States from 2008-2017, collated by the National Science Foundation
readr::read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-02-19/phd_by_field.csv")
I would like to see:
- A description in words as to how you need to wrangle the data to make it amendable for creating this plot
- Your code for making the plot along with annotations for what all of the code does
Deadlines
This assignment will be due on Tuesday, October 13, 2026 at 11:59pm.