knitr::opts_chunk$set(echo = FALSE)
knitr::opts_chunk$set(warning = FALSE)
library(tidyverse)
library(tidyverse)
library(patchwork)
library(correltools)
PROJECT_ID <- params$project_id
ANON_PATH <- params$anon_path
appl <- readr::read_csv(ANON_PATH)

Report metadata:

Introduction

Helpful links for team selection committee

Project roles by gender

gender_labels <- c(female = 'female', male = 'male', non_binary = 'nonbinary', not_disclosed = 'not disclosed')
roles_labels <- c(team_lead = 'Team lead', team_member = 'Team member', team_trainee = 'Team trainee')

theme_set(correltools::theme_correlaid(base_size = 12))

#determine y axis limit for all plots
lim_y <- max(appl %>% count(project_role) %>% pull(n) %>% max(),
             appl %>% count(gender) %>% pull(n) %>% max())

gender <- ggplot(appl, aes(x = gender, fill = gender))+
  geom_bar()+
  correltools::scale_fill_correlaid_d(labels = gender_labels)+
  scale_x_discrete(labels = gender_labels)+
  theme(axis.title.x = element_blank(),
        axis.title.y = element_blank())+
  scale_y_continuous(limits = c(0, lim_y), breaks = seq(0, lim_y, 2))+
  labs(fill = 'Gender')

roles <- ggplot(appl, aes(x = project_role))+
  geom_bar()+
  scale_x_discrete(labels = roles_labels)+
  theme(axis.title.x = element_blank(),
        axis.title.y = element_blank())+
  scale_y_continuous(limits = c(0, lim_y), breaks = seq(0, lim_y, 2))

roles_by_gender <- ggplot(appl, aes(x = project_role, fill = gender))+
  geom_bar(position = position_dodge2(preserve = "single", padding = 0))+
  correltools::scale_fill_correlaid_d(labels = gender_labels)+
  scale_x_discrete(labels = roles_labels)+
  theme(axis.title.x = element_blank(),
        axis.title.y = element_blank())+
  scale_y_continuous(limits = c(0, lim_y), breaks = seq(0, lim_y, 2))+
  labs(fill = 'Gender')


( (gender + roles) / roles_by_gender) +
  plot_layout(guides = 'collect') +
  plot_annotation(title = 'Number of applications',
                  subtitle = 'By gender, by role, and by gender and role')
female <- appl %>% 
  filter(gender == "female") %>% 
  arrange(project_role) %>% 
  pull(applicant_id)

res <- lapply(female, function(x) {
  params <- list(applicant_id = x, anon_path = ANON_PATH)
  knitr::knit_child(
    'zzz_template_application_single.Rmd', envir = environment(), quiet = TRUE
  )
})

cat(unlist(res), sep = '\n')
male <- appl %>% 
  filter(gender == "male") %>% 
  arrange(applicant_id) %>% 
  pull(applicant_id)
res <- lapply(male, function(x) {
  params <- list(applicant_id = x, anon_path = ANON_PATH)
  knitr::knit_child(
    'zzz_template_application_single.Rmd', envir = environment(), quiet = TRUE
  )
})
cat(unlist(res), sep = '\n')
div_nonbinary <- appl %>% 
  filter(gender == 'non_binary') %>% 
  arrange(applicant_id) %>% 
  pull(applicant_id)

res <- lapply(div_nonbinary, function(x) {
  params <- list(applicant_id = x, anon_path = ANON_PATH)
  knitr::knit_child(
    'zzz_template_application_single.Rmd', envir = environment(), quiet = TRUE
  )
})

cat(unlist(res), sep = '\n')
not_disclosed <- appl %>% 
  filter(gender == 'not_disclosed') %>% 
  arrange(applicant_id) %>% 
  pull(applicant_id)

res <- lapply(not_disclosed, function(x) {
  params <- list(applicant_id = x, anon_path = ANON_PATH)
  knitr::knit_child(
    'zzz_template_application_single.Rmd', envir = environment(), quiet = TRUE
  )
})

cat(unlist(res), sep = '\n')


CorrelAid/projectutils documentation built on Oct. 7, 2022, 4:40 a.m.