open-discourse / opendiscouRse

Package containing functions to obtain descriptive statistics and analyses of the Open Discourse database.
https://open-discourse.github.io/opendiscouRse/
Other
3 stars 0 forks source link

#22 faction color data #31

Closed lwarode closed 2 years ago

lwarode commented 2 years ago

2 sample workflows:

speeches_20 <- speeches %>% 
  filter(electoral_term == 20) %>% 
  left_join(factions, by = c("faction_id" = "id")) %>% 
  mutate(color = get_faction_color(abbreviation, "faction_name")) 

speeches_20 %>% 
  ggplot(aes(abbreviation, fill = abbreviation)) +
  geom_bar() + 
  scale_fill_manual(values = speeches_20$color)
speeches_20 <- speeches %>% 
  filter(electoral_term == 20) %>% 
  left_join(factions, by = c("faction_id" = "id")) %>% 
  mutate(color = get_faction_color(abbreviation, "faction_name")) 

speeches_20 %>%
  ggplot(aes(abbreviation, fill = abbreviation)) +
  geom_bar() +
  scale_fill_manual(
    values = speeches_20 %>%
      distinct(abbreviation) %>%
      pull(abbreviation) %>%
      get_faction_color("faction_name")
  )