This is an extension of the tidytuesday assignment you have already done. Complete the questions below, using the screencast you chose for the tidytuesday assigment.
library(tidyverse)
library(lubridate)
theme_set(theme_light())
seattle_pets <- readr::read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-03-26/seattle_pets.csv") %>%
mutate(license_issue_date = mdy(license_issue_date)) %>%
rename(animal_name = animals_name)
The data is pet names In Seattle which accounts to 52,519 pets. Pets meaing dog, cats, 38 goats and 6 pigs.The data shows common animal names which are Lucy, Charlie, Luna, Bella, Max, Daisy, Molly and Jack. The data also shows primary breed. ## Visualize data Hint: One graph of your choice.
seattle_pets %>%
filter(license_issue_date >= "2017-01-01") %>%
count(species, primary_breed, sort = TRUE) %>%
filter(species %in% c("Cat", "Dog")) %>%
mutate(percent = n / sum(n)) %>%
group_by(species) %>%
top_n(10, percent) %>%
ungroup() %>%
mutate(primary_breed = fct_reorder(primary_breed, percent)) %>%
ggplot(aes(primary_breed, percent, fill = species)) +
geom_col(show.legend = FALSE) +
scale_y_continuous(labels = scales::percent_format()) +
facet_wrap(~ species, scales = "free_y", ncol = 1) +
coord_flip() +
labs(x = "Primary breed",
y = "% of this species",
title = "Most common cat and dog breeds",
subtitle = "Of licensed pets in Seattle 2017-2018")
The story behind the graph shows the most common cat and dog breeds of licensed pets in Seattle 2017-2018. Y-axise is primary breed and the x-axis shows the percentage of species in seattle. For example, there is about %9 of