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

data manipulation fun for `plot_dist()` #12

Open lwarode opened 2 years ago

lwarode commented 2 years ago

create data manipulation fun/method that corresponds with plot_dist()

# age of first speech per electoral term
speeches %>%
  select(- speech_content) %>%
  group_by(electoral_term, politician_id) %>%
  filter(date == min(date)) %>%
  distinct(politician_id, electoral_term, .keep_all = T) %>%
  left_join(politicians, by = c("politician_id" = "id")) %>%
  mutate(age_first_speech_lp = get_age_hist(date, birth_date) %>% as.numeric) %>%
  ungroup() %>% 
  plot_dist("age_first_speech_lp", "electoral_term")
lwarode commented 2 years ago