From a1ca8cc8c7af766c2522f627f43315bc10c00ea9 Mon Sep 17 00:00:00 2001 From: Colin Gross Date: Tue, 19 May 2020 15:52:45 -0400 Subject: [PATCH] Provide overview at top of page1 as per meeting. Make title case consistent in headers. --- main.R | 19 ++++++++++++------- report.Rnw | 20 ++++++++++++-------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/main.R b/main.R index c82f0e2..fc007cf 100644 --- a/main.R +++ b/main.R @@ -187,6 +187,13 @@ line_plot <- function(maptg_data, measure_id){ theme(legend.position="bottom", legend.box.spacing = unit(0,"mm")) } +numerator_sum <- function(maptg_data, measure_id, recipient){ +m14_sum <- maptg_data %>% + filter(measure == measure_id, ascribee == recipient) %>% + pull(numerator) %>% + sum() +} + ###################### # Process Input Data # ###################### @@ -213,12 +220,11 @@ INCLUDE_CID <- FALSE # Generate Report Content # ########################### -#### SUM: Women Delievered -m14_sum <- maptg_data %>% - filter(measure == "M14", ascribee == RECIP) %>% - pull(numerator) %>% - sum() - +#### SUMS: OVERVIEW +m14_sum <- numerator_sum(maptg_data, "M14", RECIP) +m5_sum <- numerator_sum(maptg_data, "M5", RECIP) +m1_sum <- numerator_sum(maptg_data, "M1", RECIP) + #### FIGURE plot_data <- maptg_data %>% filter(measure =="M14", ascribee == RECIP) %>% @@ -376,7 +382,6 @@ figE8F578 <- ggplot(plot_data, aes(x=short_name)) + legend.key.size = unit(4, "mm") ) + #guides(color=guide_legend(override.aes=list(fill="Provided"))) + ylab("Number of Women") -figE8F578 content_id <- deparse(substitute(figE8F578)) infoE8F578 <- paste(content_id, "m16,17,18") diff --git a/report.Rnw b/report.Rnw index 396a468..8a570db 100644 --- a/report.Rnw +++ b/report.Rnw @@ -99,15 +99,19 @@ if(INCLUDE_CID){ cat('\\includeCIDtrue') }else{ cat('\\includeCIDfalse') } \begin{minipage}[t][0.28\textheight][t]{0.5\textwidth} % Add strut to top of minipage to provide alignment baseline \strut\vspace*{-\baselineskip}\newline - % content \parbox{\textwidth}{ \centering - \vspace{10mm} - \textbf{\Huge \Sexpr{m14_sum}}\par - \vspace{2mm} - {\small Women in aged 15 -- 44 who had a live birth}\par - {\tiny Measure 14}\par + Overview for Women Aged 15-44 Who Delivered\\\par + \vspace{4mm} + \textbf{\Large \Sexpr{m14_sum}}\par + Had a live birth\\ + \vspace{3mm} + \textbf{\Large \Sexpr{m5_sum}}\par + Received Counseling\\ + \vspace{3mm} + \textbf{\Large \Sexpr{m1_sum}}\par + Received Immmediate Contraception\\ } % lower filler \vfill @@ -229,7 +233,7 @@ if(INCLUDE_CID){ cat('\\includeCIDtrue') }else{ cat('\\includeCIDfalse') } \parbox{\textwidth}{ {\tiny \Sexpr{infoBDBC81}} \par } \fi \centering - Women who had a live birth and recieve their preferred contraceptive\\ + Women Who had a Live Birth and Recieved Their Preferred Contraceptive\\ \vspace{2mm} << dbg1, include=TRUE, fig.show='hold', fig.width=2.5, fig.height=2.5, dev='pdf' >>= figBDBC81 @@ -242,7 +246,7 @@ if(INCLUDE_CID){ cat('\\includeCIDtrue') }else{ cat('\\includeCIDfalse') } \ifincludeCID \parbox{\textwidth}{ {\tiny \Sexpr{infoE8F578}} \par } \fi - Proportion of contraception preferred and provided\\ + Proportion of Contraception Preferred and Provided\\ \centering << dbg2, include=TRUE, fig.show='hold', fig.width=4, fig.height=2.8, dev='pdf' >>= figE8F578