<- gapminder |>
subset filter(country %in% c("county1", "country2", "country3"))
Homework 2
Instructions
In this homework, you’ll pose a question regarding the Gapminder dataset and investigate it graphically. Rather than using the gapminder
package like we did in lecture, you’ll want to use the dslabs
package1, which has a larger subset of the Gapminder data (i.e. more observations and variables).
- At the beginning of your document, write down a research question that is based on the Gapminder dataset (e.g., “How does population change over time in different countries?”)
- Create 3-6 plots to answer/investigate your research question. Consider histograms (
geom_histogram()
), scatterplots (geom_point()
), or lineplots (geom_line()
). - Be sure all titles, axes, and legends are clearly labelled (no raw variable names).
- Include at least one plot with
facet_wrap()
orfacet_grid()
. - You can use other
geoms
like bar charts, box plots, add meaningful vertical or horizontal lines, etc. You may find this data visualization cheat sheet helpful.
Your document should be pleasant for a peer to look at, with some organization. You must write up your observations in words as well as showing the graphs. Upload both the .qmd
file and the .html
file to Canvas.
Optional: If you’d like to compare several specific countries, you can adapt the following pseudo_code below to create a subset of the data with as many countries as you like. Replace "country1"
et al. with the country name as it appears in the dataset. Use unique(gapminder$country)
to see a complete list of all the countries available.:
Due Dates
# | Homework Due | Peer Review Due |
---|---|---|
1 | 2 April | 7 April |
2 | 9 April | 14 April |
3 | 16 April | 21 April |
4 | 23 April | 28 April |
5 | 30 April | 5 May |
6 | 7 May | 12 May |
7 | 14 May | 19 May |
8 | 21 May | 26 May |
9 | 28 May | 2 June |
Footnotes
Remember to install the package in your console first (not in your qmd file) and then load it with the library() function.↩︎