Hooray for Spring Break! I finally have a few minutes of “What programming do you do on the side?” time to take on my first #TidyTuesday. This week the data set was about pets in the Seattle area.
https://github.com/rfordatascience/tidytuesday/tree/master/data/2019/2019-03-26
library("tidyverse")
library("readxl")
df <- read_excel("SeattlePetNames.xlsx")
My silly example will be about the first initial of the pets’ names, and then faceted by cats or dogs.
df %>%
mutate(initial = str_to_upper(str_sub(animals_name, 1,1))) %>%
filter(species %in% c("Cat", "Dog")) %>%
ggplot(aes(x = initial, fill = initial)) +
geom_bar(stat = "count") +
facet_grid(rows = vars(species)) +
labs(title = "Tidy Tuesday (March 26, 2019)",
subtitle = "by Derek Sollberger",
caption = "Data source: Seattle's open data portal") +
theme(legend.position = "none")