ggplot 102: Facets, Scales, Labels, and Themes (but now 🐶) recitation
Week 6
Introduction
We will practice what we learned this week in ggplot102 on:
Load libraries and data
Before we get started, let’s load our libraries and data. Today we will be looking again at some different data from the Tidy Tuesday project (here is the Github repo) about dog breeds.
install.packages("tidytuesdayR")
library(tidyverse)
library(tidytuesdayR)
We will be using the data that is from February 1, 2022, so let’s download it. The readme for this data is here.
<- ??? tuesdata
Let’s look at it. How can you do that?
Investigating
Write code to determine what the 5 most popular dog breeds in 2020 were.
What are the 5 most popular and the 5 least popular dogs across this time frame? There are many ways to do this.
Create a new variable that is a sum of all the ranks from 2013, allowing a composite score of the popularity of each dog breed across this time period.
Visualization 1
Create a plot where you take the 12 most popular dogs from 2020, and plot their popularity rank from 2013 to 2020.
To facet, you need to have the variable you want to facet in one column.
Visualization 2
Alter the aesthetics of this plot until you think it looks good.
Investigate more
What dog has jumped in the rankings most from 2013 to 2020? What has dropped the most?