library(magrittr) library(readxl) library(ggplot2) library(lubridate) library(gridExtra) library(kableExtra) knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE, fig.pos='!H') options(qwraps2_markup = 'markdown') # Qwraps2 parameters prec <- 1 #kableExtra table parameters table_fs <- 7 figsize <- 3 total_row_ft <- "gray" total_row_ft2 <- "white" striped_row_bg <- "gray!10" total_row_bg2 <- "gray"
\fancypagestyle{plain}{\pagestyle{fancy}} \pagestyle{fancy} \fancyhf{} \setlength{\headheight}{32pt} \renewcommand{\headrulewidth}{0pt} \fancyhead[C]{\includegraphics[width=10cm]{banner.png}} \fancyfoot[R]{Page \thepage\ of \pageref{LastPage}} \fancyfoot[L]{TIMCI SPA Operational Report v1.0}
\setcounter{tocdepth}{2} \tableofcontents
\newpage
r notice_str
r intro_str
is_india <- Sys.getenv('TIMCI_COUNTRY') == 'India' is_tanzania <- Sys.getenv('TIMCI_COUNTRY') == 'Tanzania' is_kenya <- Sys.getenv('TIMCI_COUNTRY') == 'Kenya' is_senegal <- Sys.getenv('TIMCI_COUNTRY') == 'Senegal' is_rct <- is_tanzania | is_india is_ls <- is_kenya | is_senegal
spa_sco_data <- params$spa_sco_data spa_cgei_data <- params$spa_cgei_data spa_fa_data <- params$spa_fa_data spa_hcpi_data <- params$spa_hcpi_data
spa_sco_is_not_null <- !is.null(spa_sco_data) if(spa_sco_is_not_null) { spa_sco_is_not_null <- (nrow(spa_sco_data) > 0) & (length(spa_sco_data) > 0) } spa_cgei_is_not_null <- !is.null(spa_cgei_data) if(spa_cgei_is_not_null) { spa_cgei_is_not_null <- (nrow(spa_cgei_data) > 0) & (length(spa_cgei_data) > 0) } spa_fa_is_not_null <- !is.null(spa_fa_data) if(spa_fa_is_not_null) { spa_fa_is_not_null <- (nrow(spa_fa_data) > 0) & (length(spa_fa_data) > 0) } spa_hcpi_is_not_null <- !is.null(spa_hcpi_data) if(spa_hcpi_is_not_null) { spa_hcpi_is_not_null <- (nrow(spa_hcpi_data) > 0) & (length(spa_hcpi_data) > 0) } spa_is_not_null <- spa_sco_is_not_null | spa_cgei_is_not_null | spa_fa_is_not_null | spa_hcpi_is_not_null
start_date <- NULL end_date <- NULL
sco_start_date <- NULL sco_end_date <- NULL if (spa_sco_is_not_null) { sco_start_date <- min(spa_sco_data$date) sco_end_date <- max(spa_sco_data$date) } cgei_start_date <- NULL cgei_end_date <- NULL if (spa_cgei_is_not_null) { if (nrow(spa_cgei_data) > 0) { cgei_start_date <- min(spa_cgei_data$date) cgei_end_date <- max(spa_cgei_data$date) } } fa_start_date <- NULL fa_end_date <- NULL if (spa_fa_is_not_null) { if (nrow(spa_fa_data) > 0) { fa_start_date <- min(spa_fa_data$date) fa_end_date <- max(spa_fa_data$date) } } hcpi_start_date <- NULL hcpi_end_date <- NULL if (spa_hcpi_is_not_null) { if (nrow(spa_hcpi_data) > 0) { hcpi_start_date <- min(spa_hcpi_data$date) hcpi_end_date <- max(spa_hcpi_data$date) } } start_date <- min(sco_start_date, cgei_start_date, fa_start_date, hcpi_start_date) end_date <- max(sco_end_date, cgei_end_date, fa_end_date, hcpi_end_date)
if (Sys.getenv('TIMCI_COUNTRY') == 'Senegal') { cat(paste0("Ce rapport couvre la période du **", start_date, "** (début de l'étude) au **", end_date, "** pour le **Sénégal**.")) } else { cat(paste0("This report covers the period from **", start_date, "** (study start) to **", end_date, "** for **", Sys.getenv('TIMCI_COUNTRY'), "**.")) }
# obs_count <- all %>% # dplyr::group_by(facility_name) %>% # dplyr::summarise("Observed children" = n_distinct(child_id), # "Observed providers" = n_distinct(hcp_id)) %>% # bind_rows(dplyr::summarise(., # across(where(is.numeric), sum), # across(where(is.character), ~"Total"))) %>% # rowwise() %>% # dplyr::mutate(Total = sum(c_across(where(is.numeric)), na.rm = TRUE)) # # obs_count %>% # kableExtra::kbl(booktabs = TRUE, # linesep = "", # align = c("c", "c", "c"), # caption = "Number of consultation observations") %>% # kableExtra::kable_styling(latex_options = c("HOLD_position", "repeat_header"), font_size = table_fs) %>% # kableExtra::row_spec(0, bold = TRUE) %>% # kableExtra::row_spec(1:(nrow(obs_count)/2) * 2, background = striped_row_bg)
\newpage \listoftables
\newpage \listoffigures
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.