Number of households, and proportion headed by person with a disability

# Remove non-consenting participants
data <- data[data$consent == 'Yes' & !is.na(data$branch), ]

# Ns, by branch and disability status 
t1 <- data %>% 
  mutate(is_pwd = ifelse(pwd == 1, 1, 0), branch = as.character(branch)) %>%
  filter(!is.na(branch) & !is.na(is_pwd)) %>% 
  count(branch, is_pwd) %>% 
  group_by(branch) %>%
  mutate(N = sum(n), prop_pwd = paste0(round(100*n/N,0), '%')) %>%
  select(-N) %>%
  tidyr::pivot_wider(names_from = is_pwd, values_from = c(n, prop_pwd)) %>% 
  select(-prop_pwd_0)

knitr::kable(t1, digits = 2, col.names = c('Branch','N not pwd', 'N pwd', '% pwd'),
             caption = 'Households', align = 'lccc') %>%
  kable_styling(
      bootstrap_options = c("striped", "hover", "condensed", "responsive"),
                  font_size = 7, fixed_thead = T)
Households
Branch N not pwd N pwd % pwd
Anaka 316 148 32%
Goma 320 127 28%
Gulu 331 163 33%
Kamdini 252 149 37%
Kigumba 285 79 22%
Lacor 231 142 38%
Loro 253 113 31%
Minakulu 351 127 27%

Number of individuals included in the survey (including secondary household members)

# Ns total people covered by the survey (listed in the rosters)
t2 <- data[, c('branch', 'res_gender', colnames(data)[grep("s23_", colnames(data))])] %>%
  tidyr::pivot_longer(cols = c(2:ncol(.)), names_to = 'HH_member', values_to = 'gender') %>%
  filter(!is.na(gender)) %>% 
  count(branch, gender) %>% 
  tidyr::pivot_wider(names_from = gender, values_from = n) %>% 
  group_by(branch) %>% 
  mutate(Females = paste0(Female,'/', (Male+Female), ' (', round(100*Female/(Male+Female)),'%)')) %>% 
  select(-Male)

knitr::kable(t2, digits = 2, caption = 'Individuals', align = 'lcc') %>%
  kable_styling(
      bootstrap_options = c("striped", "hover", "condensed", "responsive"),
                  font_size = 7, fixed_thead = T)
Individuals
branch Female Females
Gulu 1817 1817/2978 (61%)
Lacor 1470 1470/2434 (60%)
Anaka 1999 1999/3381 (59%)
Goma 1918 1918/3304 (58%)
Minakulu 1787 1787/3010 (59%)
Kamdini 1527 1527/2582 (59%)
Loro 1421 1421/2361 (60%)
Kigumba 1423 1423/2477 (57%)