TidyTuesday: Animal Crossing
May 6, 2020
Christopher Yee
1 minute read

Data from #tidytuesday week of 2020-05-05 (source)

Load packages

library(tidyverse)
library(ggfortify)

Download data

villagers_raw <- read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-05-05/villagers.csv')

Process data

villagers <- villagers_raw %>% 
  select(gender, species, personality) %>% 
  mutate(species = str_to_title(species)) %>%
  group_by(gender, species, personality) %>% 
  summarize(n = n()) %>% 
  mutate(pct_total = n / sum(n)) %>% 
  ungroup() 

Visualize data

villagers %>% 
  ggplot(aes(personality, pct_total, fill = gender, color = gender, group = gender)) +
  geom_polygon(alpha = 0.5) +
  geom_point() +
  coord_polar() +
  facet_wrap(~species) +
  labs(x = NULL, y = NULL, color = NULL, fill = NULL, 
       title = "Animal Crossing: villager personality traits by species & gender",
       caption = "by: @eeysirhc\nsource:VillagerDB") +
  theme_bw() +
  theme(legend.position = 'top',
        axis.text.y = element_blank(),
        axis.ticks.y = element_blank())

Moment of zen