General respondent details

Code
library(tidyverse)
library(targets)
library(scales)
library(gt)
library(here)

tar_config_set(store = here('_targets'),
               script = here('_targets.R'))

tar_load(c(survey_orgs, survey_countries))

# Plotting functions
invisible(list2env(tar_read(graphic_functions), .GlobalEnv))
invisible(list2env(tar_read(table_functions), .GlobalEnv))

How many NGOs responded?

Code
nrow(survey_orgs)
## [1] 641

How many respondents answered questions for more than one country?

Code
survey_countries %>% 
  summarize(more_than_1 = sum(loop.number > 1),
            prop = more_than_1 / nrow(survey_orgs))
## # A tibble: 1 × 2
##   more_than_1   prop
##         <int>  <dbl>
## 1          18 0.0281

Who in the organization responded to the survey?

Code
df_plot_respondents <- survey_orgs %>%
  group_by(Q2.3) %>%
  summarise(num = n()) %>%
  arrange(num) %>% 
  mutate(question = fct_inorder(Q2.3)) 

df_plot_respondents %>% 
  ggplot(aes(x = num, y = question)) +
  geom_col() +
  scale_x_continuous(expand = c(0, 0),
                     sec.axis = sec_axis(~ . / sum(df_plot_respondents$num),
                                         labels = label_percent())) +
  labs(x = "Respondents", y = NULL,
       title = "Who filled out the survey?",
       subtitle = "Q2.3: What is your position in your organization?") +
  theme_ingo()

Lots of others. Who are the others?

Code
survey_orgs %>%
  filter(!is.na(Q2.3_TEXT)) %>%
  mutate(`Position in organization` = str_to_title(Q2.3_TEXT)) %>%
  group_by(`Position in organization`) %>%
  summarise(Count = n()) %>%
  mutate(Proportion = Count / sum(Count)) %>%
  arrange(desc(Count)) %>% 
  gt() %>% 
  fmt_percent(columns = Proportion, decimals = 1) %>% 
  opts_int() %>% opts_theme()