write(formats2h2("Generate the context subsection"), stderr())

r h1_context


if (Sys.getenv('TIMCI_COUNTRY') == 'Tanzania' || Sys.getenv('TIMCI_COUNTRY') == 'Kenya') {
  facilities$type <- tolower(facilities$type)
  hc_nb <- nrow(facilities %>% dplyr::filter(type == "health center"))
  dispensary_nb <- nrow(facilities %>% dplyr::filter(type == "dispensary"))
  cat(paste0("**", facility_nb, "** research facilities, among which **", hc_nb, "** health centres and **", dispensary_nb, "** dispensaries"))
} else if (Sys.getenv('TIMCI_COUNTRY') == 'India') {
  hc_nb <- nrow(facilities %>% dplyr::filter(type == "CHC"))
  dispensary_nb <- nrow(facilities %>% dplyr::filter(type == "PHC"))
  cat(paste0("**", facility_nb, "** research facilities, among which **", hc_nb, "** community health centres (CHCs) and **", dispensary_nb, "** primary health centres (PHCs)"))
} else if (Sys.getenv('TIMCI_COUNTRY') == 'Senegal'){
  cat(paste0("**", facility_nb, "** postes de recherche"))
} else{
  cat(paste0("**", facility_nb, "** research facilities"))
}
facility_disp  %>% 
  kableExtra::kbl(booktabs = TRUE,
                  longtable = TRUE, 
                  linesep = "",
                  caption = facility_cap,
                  align = c("c", "c", "c")) %>% 
  kableExtra::kable_styling(latex_options = c("HOLD_position", "repeat_header"),
                            font_size = table_fs) %>%
  kableExtra::row_spec(0, color = total_row_ft2, background = total_row_bg2, bold = TRUE) %>%
  kableExtra::collapse_rows(columns = 1, valign = "top") 
if (Sys.getenv('TIMCI_COUNTRY') == "Kenya") {
  hc_enrolment_target <- 8
  dispensary_enrolment_target <- 4
  day_target <- dispensary_enrolment_target * dispensary_nb + hc_enrolment_target * hc_nb
  enrolment_target <- round(day_target / facility_nb, 0)
} else if (Sys.getenv('TIMCI_COUNTRY') == "Senegal") {
  enrolment_target <- 4
} else if (Sys.getenv('TIMCI_COUNTRY') == "Tanzania") {
  hc_enrolment_target <- 16
  dispensary_enrolment_target <- 4
  day_target <- dispensary_enrolment_target * dispensary_nb + hc_enrolment_target * hc_nb
  enrolment_target <- round(day_target / facility_nb, 0)
} else if (Sys.getenv('TIMCI_COUNTRY') == "India") {
  hc_enrolment_target <- 22/6
  dispensary_enrolment_target <- 4/6
  day_target <- dispensary_enrolment_target * dispensary_nb + hc_enrolment_target * hc_nb
  enrolment_target <- ceiling(day_target / facility_nb)
} else{
  enrolment_target <- 8
}


Thaliehln/timci documentation built on April 8, 2024, 3:38 p.m.