diff --git a/NAMESPACE b/NAMESPACE index 716e685..c644649 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -28,7 +28,7 @@ export(create_op_screening) export(create_op_visual) export(create_op_wash) export(estimate_classic) -export(estimate_op_all) +export(estimate_op) export(estimate_probit) export(merge_estimates) export(probit_gam) diff --git a/R/01-opIndicators.R b/R/01-opIndicators.R index 25eeb58..4298f89 100644 --- a/R/01-opIndicators.R +++ b/R/01-opIndicators.R @@ -1,14 +1,30 @@ #' #' Create older people indicators dataset from survey data collected using the -#' standard RAM-OP questionnaire. The indicator sets covered by the standard -#' RAM-OP survey are: +#' standard RAM-OP questionnaire. +#' +#' @description +#' The indicator sets covered by the standard RAM-OP survey are: +#' +#' * Demographic indicators +#' * Dietary intake indicators +#' * Household hunger scale +#' * Katz Index of Independence in Activities of Daily Living score +#' * K6 Short form psychological distress score +#' * Brief Community Screening Instrument for Dementia (CSID) +#' * Health and health-seeking indicators +#' * Income and income sources +#' * Water, sanitation and hygiene (WASH) indicators +#' * Anthropometry and screening +#' * Visual impairment by "Tumbling E" method +#' * Miscellaneous indicators +#' * Washington Group on Disability #' #' @section Demographic indicators: #' #' **Variable** | **Description** #' :--- | :--- -#' `psu`` | Primary sampling unit -#' `resp1`` | Respondent is SUBJECT +#' `psu` | Primary sampling unit +#' `resp1` | Respondent is SUBJECT #' `resp2` | Respondent is FAMILY CARER #' `resp3` | Respondent is OTHER CARER #' `resp4` | Respondent is OTHER @@ -42,9 +58,9 @@ #' #' **Variable** | **Description** #' :--- | :--- -#' `MF`` | Meal frequency -#' `DDS`` | Dietary Diversity Score (count of 11 groups) -#' `FG01`` | Cereals +#' `MF` | Meal frequency +#' `DDS` | Dietary Diversity Score (count of 11 groups) +#' `FG01` | Cereals #' `FG02` | Roots and tubers #' `FG03` | Fruits and vegetables #' `FG04` | All meat @@ -105,18 +121,18 @@ #' #' **Variable** | **Description** #' :--- | :--- -#' ADL01 | Bathing -#' ADL02 | Dressing -#' ADL03 | Toileting -#' ADL04 | Transferring (mobility) -#' ADL05 | Continence -#' ADL06 | Feeding -#' scoreADL | ADL Score -#' classADL1 | Severity of dependence 1 -#' classADL2 | Severity of dependence 2 -#' classADL3 | Severity of dependence 3 -#' hasHelp | Have someone to help with everyday activities -#' unmetNeed | Need help but has no helper +#' `ADL01` | Bathing +#' `ADL02` | Dressing +#' `ADL03` | Toileting +#' `ADL04` | Transferring (mobility) +#' `ADL05` | Continence +#' `ADL06` | Feeding +#' `scoreADL` | ADL Score +#' `classADL1` | Severity of dependence 1 +#' `classADL2` | Severity of dependence 2 +#' `classADL3` | Severity of dependence 3 +#' `hasHelp` | Have someone to help with everyday activities +#' `unmetNeed` | Need help but has no helper #' #' @section K6 Short form psychological distress score: #' @@ -129,8 +145,8 @@ #' #' **Variable** | **Description** #' :--- | :--- -#' K6 | K6 score -#' K6Case | K6 score > 12 (in serious psychological distress) +#' `K6` | K6 score +#' `K6Case` | K6 score > 12 (in serious psychological distress) #' #' @section Brief Community Screening Instrument for Dementia (CSID): #' @@ -144,49 +160,49 @@ #' #' **Variable** | **Description** #' :--- | :--- -#' DS | Probable dementia by CSID screen +#' `DS` | Probable dementia by CSID screen #' #' @section Health and health-seeking indicators: #' #' **Variable** | **Description** #' :--- | :--- -#' H1 | Chronic condition -#' H2 | Takes drugs regularly for chronic condition -#' H31 | No drugs available -#' H32 | Too expensive / no money -#' H33 | Too old to look for care -#' H34 | Use traditional medicine -#' H35 | Drugs don't help -#' H36 | No-one to help me -#' H37 | No need -#' H38 | Other -#' H39 | No reason given -#' H4 | Recent disease episode -#' H5 | Accessed care for recent disease episode -#' H61 | No drugs available -#' H62 | Too expensive / no money -#' H63 | Too old to look for care -#' H64 | Use traditional medicine -#' H65 | Drugs don't help -#' H66 | No-one to help me -#' H67 | No need -#' H68 | Other -#' H69 | No reason given +#' `H1` | Chronic condition +#' `H2` | Takes drugs regularly for chronic condition +#' `H31` | No drugs available +#' `H32` | Too expensive / no money +#' `H33` | Too old to look for care +#' `H34` | Use traditional medicine +#' `H35` | Drugs don't help +#' `H36` | No-one to help me +#' `H37` | No need +#' `H38` | Other +#' `H39` | No reason given +#' `H4` | Recent disease episode +#' `H5` | Accessed care for recent disease episode +#' `H61` | No drugs available +#' `H62` | Too expensive / no money +#' `H63` | Too old to look for care +#' `H64` | Use traditional medicine +#' `H65` | Drugs don't help +#' `H66` | No-one to help me +#' `H67` | No need +#' `H68` | Other +#' `H69` | No reason given #' #' @section Income and income sources: #' #' **Variable** | **Description** #' :--- | :--- -#' M1 | Has a personal income -#' M2A | Agriculture / fishing / livestock -#' M2B | Wages / salary -#' M2C | Sale of charcoal / bricks / etc. -#' M2D | Trading (e.g. market or shop) -#' M2E | Investments -#' M2F | Spending savings / sale of assets -#' M2G | Charity -#' M2H | Cash transfer / Social security -#' M2I | Other +#' `M1` | Has a personal income +#' `M2A` | Agriculture / fishing / livestock +#' `M2B` | Wages / salary +#' `M2C` | Sale of charcoal / bricks / etc. +#' `M2D` | Trading (e.g. market or shop) +#' `M2E` | Investments +#' `M2F` | Spending savings / sale of assets +#' `M2G` | Charity +#' `M2H` | Cash transfer / Social security +#' `M2I` | Other #' #' @section Water, sanitation and hygiene (WASH) indicators: #' @@ -198,18 +214,18 @@ #' #' **Variable** | **Description** #' :--- | :--- -#' W1 | Improved source of drinking water -#' W2 | Safe drinking water (improved source OR adequate treatment) -#' W3 | Improved sanitation facility -#' W4 | Improved non-shared sanitation facility +#' `W1` | Improved source of drinking water +#' `W2` | Safe drinking water (improved source OR adequate treatment) +#' `W3` | Improved sanitation facility +#' `W4` | Improved non-shared sanitation facility #' #' @section Anthropometry and screening: #' #' **Variable** | **Description** #' :--- | :--- -#' MUAC | Mid-upper arm circumference (mm) -#' oedema | Bilateral pitting oedema (may not be nutritional) -#' screened | Either MUAC or oedema checked previously +#' `MUAC` | Mid-upper arm circumference (mm) +#' `oedema` | Bilateral pitting oedema (may not be nutritional) +#' `screened` | Either MUAC or oedema checked previously #' #' @section Visual impairment by "Tumbling E" method: #' @@ -226,9 +242,9 @@ #' #' **Variable** | **Description** #' :--- | :--- -#' chew | Problems chewing food -#' food | Anyone in HH receives a ration -#' NFRI | Anyone in HH received non-food relief item/s (NFRI) in previous month +#' `chew` | Problems chewing food +#' `food` | Anyone in HH receives a ration +#' `NFRI` | Anyone in HH received non-food relief item/s (NFRI) in previous month #' #' @section Washington Group on Disability: #' @@ -241,35 +257,35 @@ #' #' **Variable** | **Description** #' :--- | :--- -#' wgVisionD0 | Vision domain 0 -#' wgVisionD1 | Vision domain 1 -#' wgVisionD2 | Vision domain 2 -#' wgVisionD3 | Vision domain 3 -#' wgHearingD0 | Hearing domain 0 -#' wgHearingD1 | Hearing domain 1 -#' wgHearingD2 | Hearing domain 2 -#' wgHearingD3 | Hearing domain 3 -#' wgMobilityD0 | Mobility domain 0 -#' wgMobilityD1 | Mobility domain 1 -#' wgMobilityD2 | Mobility domain 2 -#' wgMobilityD3 | Mobility domain 3 -#' wgRememberingD0 | Remembering domain 0 -#' wgRememberingD1 | Remembering domain 1 -#' wgRememberingD2 | Remembering domain 2 -#' wgRememberingD3 | Remembering domain 3 -#' wgSelfCareD0 | Self-care domain 0 -#' wgSelfCareD1 | Self-care domain 1 -#' wgSelfCareD2 | Self-care domain 2 -#' wgSelfCareD3 | Self-care domain 3 -#' wgCommunicatingD0 | Communication domain 0 -#' wgCommunicatingD1 | Communication domain 1 -#' wgCommunicatingD2 | Communication domain 2 -#' wgCommunicatingD3 | Communication domain 3 -#' wgP0 | Overall 0 -#' wgP1 | Overall 1 -#' wgP2 | Overall 2 -#' wgP3 | Overall 3 -#' wgPM | Any disability +#' `wgVisionD0` | Vision domain 0 +#' `wgVisionD1` | Vision domain 1 +#' `wgVisionD2` | Vision domain 2 +#' `wgVisionD3` | Vision domain 3 +#' `wgHearingD0` | Hearing domain 0 +#' `wgHearingD1` | Hearing domain 1 +#' `wgHearingD2` | Hearing domain 2 +#' `wgHearingD3` | Hearing domain 3 +#' `wgMobilityD0` | Mobility domain 0 +#' `wgMobilityD1` | Mobility domain 1 +#' `wgMobilityD2` | Mobility domain 2 +#' `wgMobilityD3` | Mobility domain 3 +#' `wgRememberingD0` | Remembering domain 0 +#' `wgRememberingD1` | Remembering domain 1 +#' `wgRememberingD2` | Remembering domain 2 +#' `wgRememberingD3` | Remembering domain 3 +#' `wgSelfCareD0` | Self-care domain 0 +#' `wgSelfCareD1` | Self-care domain 1 +#' `wgSelfCareD2` | Self-care domain 2 +#' `wgSelfCareD3` | Self-care domain 3 +#' `wgCommunicatingD0` | Communication domain 0 +#' `wgCommunicatingD1` | Communication domain 1 +#' `wgCommunicatingD2` | Communication domain 2 +#' `wgCommunicatingD3` | Communication domain 3 +#' `wgP0` | Overall 0 +#' `wgP1` | Overall 1 +#' `wgP2` | Overall 2 +#' `wgP3` | Overall 3 +#' `wgPM` | Any disability #' #' @param svy A data.frame collected using the standard RAM-OP questionnaire #' @param indicators A character vector of indicator set names. The vector may @@ -287,15 +303,18 @@ #' # Create indicators dataset from RAM-OP survey data collected from #' # Addis Ababa, Ethiopia #' create_op(testSVY) +#' create_op(testSVY, indicators = "demo") +#' create_op(testSVY, indicators = "hunger", sex = "m") #' #' @export #' @rdname create_op #' create_op <- function(svy, - indicators = c("demo", "food", "hunger", "disability", - "adl", "mental", "dementia", "health", - "income", "wash", "anthro", "oedema", + indicators = c("demo", "food", "hunger", + "disability", "adl", "mental", + "dementia", "health", "income", + "wash", "anthro", "oedema", "screening", "visual", "misc"), sex = c("mf", "m", "f")) { ## Check specified indicators ---- @@ -311,68 +330,6 @@ create_op <- function(svy, ) |> subset_by_sex(sex = sex) - - ## demographic indicators ---- - #demo <- create_op_demo(svy = svy) - - ## Dietary intake indicators ---- - #food <- create_op_food(svy = svy) - - ## Household Hunger Scale ---- - #hunger <- create_op_hunger(svy = svy) - - ## Katz "Index of Independence in Activities of Daily Living" (ADL) score - #adl <- create_op_adl(svy = svy) - - ## K6: Short form psychological distress score ---- - #mental <- create_op_mental(svy = svy) - - ## CISD - #dementia <- create_op_dementia(svy = svy) - - ## Health indicators : CHRONIC CONDITIONS - #health <- create_op_health(svy = svy) - - ## Income and income sources ---- - #income <- create_op_income(svy = svy) - - ## Water, Sanitation, and Hygiene (WASH) indicators ---- - #wash <- create_op_wash(svy = svy) - - ## Anthropometry and screening ---- - #anthro <- create_op_anthro(svy = svy) - #oedema <- create_op_oedema(svy = svy) - #screening <- create_op_screening(svy = svy) - - ## Visual impairment by "Tumbling E" method ---- - #visual <- create_op_visual(svy = svy) - - ## Miscellaneous indicators ---- - #misc <- create_op_misc(svy = svy) - - ## Washington Group (WG) short set of question designed to identify ---- - ## people with a disability in a census or survey format. - #disability <- create_op_disability(svy = svy) - - ## Make summary data.frame for ALL respondents ---- - # indicators <- tibble::tibble( - # demo, - # subset(food, select = c(-psu, -sex1, -sex2)), - # subset(hunger, select = c(-psu, -sex1, -sex2)), - # subset(disability, select = c(-psu, -sex1, -sex2)), - # subset(adl, select = c(-psu, -sex1, -sex2)), - # subset(mental, select = c(-psu, -sex1, -sex2)), - # subset(dementia, select = c(-psu, -sex1, -sex2)), - # subset(health, select = c(-psu, -sex1, -sex2)), - # subset(income, select = c(-psu, -sex1, -sex2)), - # subset(wash, select = c(-psu, -sex1, -sex2)), - # subset(anthro, select = c(-psu, -sex1, -sex2)), - # subset(oedema, select = c(-psu, -sex1, -sex2)), - # subset(screening, select = c(-psu, -sex1, -sex2)), - # subset(visual, select = c(-psu, -sex1, -sex2)), - # subset(misc, select = c(-psu, -sex1, -sex2)) - # ) - indicators <- lapply( X = indicators, FUN = create_op_indicators, svy = svy, sex = sex ) |> diff --git a/R/03-classicBoot.R b/R/02-classicBoot.R similarity index 100% rename from R/03-classicBoot.R rename to R/02-classicBoot.R diff --git a/R/02-merge.R b/R/02-merge.R deleted file mode 100644 index 9188fec..0000000 --- a/R/02-merge.R +++ /dev/null @@ -1,101 +0,0 @@ - -#' -#' Concatenate classic and PROBIT estimates into a single data.frame -#' -#' @param x Classic estimates data frame -#' @param y Probit estimates data frame -#' @param prop2percent Logical. Should proportion type indicators be converted -#' to percentage? Default is FALSE. -#' -#' @return Data frame of combined classic and probit estimates -#' -#' @author Ernest Guevarra -#' -#' @examples -#' # -#' \dontrun{ -#' test <- merge_estimates(x = classicEstimates, -#' y = probitEstimates) -#' } -#' -#' @export -#' - -merge_estimates <- function(x, y, prop2percent = FALSE) { - - ## Merge rows - estimates <- rbind(x, y) - - ## Merge 'estimates' data.frame and 'language' data.frame in preparation for - ## reporting and maintaining the original row ordering of the 'language' - ## data.frame ... - temp <- subset(language, subset = language$INDICATOR %in% estimates$INDICATOR) - - temp$originalOrder <- seq_len(nrow(estimates)) - - estimates <- merge(temp, estimates, by = "INDICATOR") - estimates <- estimates[order(estimates$originalOrder), ] - estimates <- subset(estimates, select = -originalOrder) - - if (prop2percent) { - estimates$EST.ALL <- ifelse( - estimates$TYPE == "Proportion", - estimates$EST.ALL * 100, - estimates$EST.ALL - ) - - estimates$LCL.ALL <- ifelse( - estimates$TYPE == "Proportion", - estimates$LCL.ALL * 100, - estimates$LCL.ALL - ) - - estimates$UCL.ALL <- ifelse( - estimates$TYPE == "Proportion", - estimates$UCL.ALL * 100, - estimates$UCL.ALL - ) - - estimates$EST.MALES <- ifelse( - estimates$TYPE == "Proportion", - estimates$EST.MALES * 100, - estimates$EST.MALES - ) - - estimates$LCL.MALES <- ifelse( - estimates$TYPE == "Proportion", - estimates$LCL.MALES * 100, - estimates$LCL.MALES - ) - - estimates$UCL.MALES <- ifelse( - estimates$TYPE == "Proportion", - estimates$UCL.MALES * 100, - estimates$UCL.MALES - ) - - estimates$EST.FEMALES <- ifelse( - estimates$TYPE == "Proportion", - estimates$EST.FEMALES * 100, - estimates$EST.FEMALES - ) - - estimates$LCL.FEMALES <- ifelse( - estimates$TYPE == "Proportion", - estimates$LCL.FEMALES * 100, - estimates$LCL.FEMALES - ) - - estimates$UCL.FEMALES <- ifelse( - estimates$TYPE == "Proportion", - estimates$UCL.FEMALES * 100, - estimates$UCL.FEMALES - ) - } - - ## Convert to tibble - estimates <- tibble::tibble(estimates) - - ## Return - estimates -} diff --git a/R/04-probitBoot.R b/R/03-probitBoot.R similarity index 100% rename from R/04-probitBoot.R rename to R/03-probitBoot.R diff --git a/R/05-probit_muac.R b/R/04-probit_muac.R similarity index 100% rename from R/05-probit_muac.R rename to R/04-probit_muac.R diff --git a/R/06-estimate_op.R b/R/05-estimate_op.R similarity index 62% rename from R/06-estimate_op.R rename to R/05-estimate_op.R index 9f5f8cc..bbd350e 100644 --- a/R/06-estimate_op.R +++ b/R/05-estimate_op.R @@ -14,27 +14,27 @@ #' @return Tibble of boot estimates for all specified standard RAM-OP indicators #' #' @examples -#' estimate_op_all(x = create_op(testSVY), w = testPSU, replicates = 9) +#' estimate_op(x = create_op(testSVY), w = testPSU, replicates = 9) #' #' @export #' -estimate_op_all <- function(x, w, - indicators = c("demo", "anthro", "food", "hunger", - "adl", "disability", "mental", - "dementia", "health", "oedema", - "screening", "income", "wash", - "visual", "misc"), - replicates = 399) { +estimate_op <- function(x, w, + indicators = c("demo", "anthro", "food", + "hunger", "adl", "disability", + "mental", "dementia", "health", + "oedema", "screening", "income", + "wash", "visual", "misc"), + replicates = 399) { ## Classic boot estimator classicIndicators <- indicators[indicators != "anthro"] ## Check if indicators more than anthro if(length(classicIndicators) != 0) { ## Bootstrap classic - classicResults <- estimate_classic(x = x, w = w, - indicators = classicIndicators, - replicates = replicates) + classicResults <- estimate_classic( + x = x, w = w, indicators = classicIndicators, replicates = replicates + ) } else { ## Assign as NULL classicResults <- NULL @@ -50,9 +50,9 @@ estimate_op_all <- function(x, w, } ## Concatenate results and structure - resultsDF <- merge_estimates(x = classicResults, - y = probitResults, - prop2percent = TRUE) + resultsDF <- merge_estimates( + x = classicResults, y = probitResults, prop2percent = TRUE + ) ## Convert to tibble resultsDF <- tibble::tibble(resultsDF) diff --git a/R/07-chart.R b/R/06-chart.R similarity index 99% rename from R/07-chart.R rename to R/06-chart.R index d22e66f..2fb0cb1 100644 --- a/R/07-chart.R +++ b/R/06-chart.R @@ -1,7 +1,8 @@ #' #' Plot RAM-OP indicators #' -#' @section The plots include: +#' @description +#' The plots include: #' #' * Age by sex (pyramid plot) - a wrapper function to the [pyramid_plot()] #' function to create an age by sex pyramid plot @@ -679,8 +680,6 @@ chart_op_hhs <- function(x, #' @export #' @rdname chart_op #' -# -################################################################################ chart_op_income <- function(x, save_chart = TRUE, diff --git a/R/08-pyramidPlot.R b/R/07-pyramidPlot.R similarity index 100% rename from R/08-pyramidPlot.R rename to R/07-pyramidPlot.R diff --git a/R/09-report.R b/R/08-report.R similarity index 100% rename from R/09-report.R rename to R/08-report.R diff --git a/R/utils.R b/R/utils.R index 336fc12..ba4bb8d 100644 --- a/R/utils.R +++ b/R/utils.R @@ -1,3 +1,105 @@ +#' +#' Concatenate classic and PROBIT estimates into a single data.frame +#' +#' @param x Classic estimates data frame +#' @param y Probit estimates data frame +#' @param prop2percent Logical. Should proportion type indicators be converted +#' to percentage? Default is FALSE. +#' +#' @return Data frame of combined classic and probit estimates +#' +#' @author Ernest Guevarra +#' +#' @examples +#' # +#' \dontrun{ +#' test <- merge_estimates(x = classicEstimates, +#' y = probitEstimates) +#' } +#' +#' @export +#' + +merge_estimates <- function(x, y, prop2percent = FALSE) { + + ## Merge rows + estimates <- rbind(x, y) + + ## Merge 'estimates' data.frame and 'language' data.frame in preparation for + ## reporting and maintaining the original row ordering of the 'language' + ## data.frame ... + temp <- subset(language, subset = language$INDICATOR %in% estimates$INDICATOR) + + temp$originalOrder <- seq_len(nrow(estimates)) + + estimates <- merge(temp, estimates, by = "INDICATOR") + estimates <- estimates[order(estimates$originalOrder), ] + estimates <- subset(estimates, select = -originalOrder) + + if (prop2percent) { + estimates$EST.ALL <- ifelse( + estimates$TYPE == "Proportion", + estimates$EST.ALL * 100, + estimates$EST.ALL + ) + + estimates$LCL.ALL <- ifelse( + estimates$TYPE == "Proportion", + estimates$LCL.ALL * 100, + estimates$LCL.ALL + ) + + estimates$UCL.ALL <- ifelse( + estimates$TYPE == "Proportion", + estimates$UCL.ALL * 100, + estimates$UCL.ALL + ) + + estimates$EST.MALES <- ifelse( + estimates$TYPE == "Proportion", + estimates$EST.MALES * 100, + estimates$EST.MALES + ) + + estimates$LCL.MALES <- ifelse( + estimates$TYPE == "Proportion", + estimates$LCL.MALES * 100, + estimates$LCL.MALES + ) + + estimates$UCL.MALES <- ifelse( + estimates$TYPE == "Proportion", + estimates$UCL.MALES * 100, + estimates$UCL.MALES + ) + + estimates$EST.FEMALES <- ifelse( + estimates$TYPE == "Proportion", + estimates$EST.FEMALES * 100, + estimates$EST.FEMALES + ) + + estimates$LCL.FEMALES <- ifelse( + estimates$TYPE == "Proportion", + estimates$LCL.FEMALES * 100, + estimates$LCL.FEMALES + ) + + estimates$UCL.FEMALES <- ifelse( + estimates$TYPE == "Proportion", + estimates$UCL.FEMALES * 100, + estimates$UCL.FEMALES + ) + } + + ## Convert to tibble + estimates <- tibble::tibble(estimates) + + ## Return + estimates +} + + #' #' Fill out a one-dimensional table to include a specified range of values #' diff --git a/inst/template/odt_template.Rmd b/inst/template/odt_template.Rmd index 3e7caa8..c3a1bd0 100644 --- a/inst/template/odt_template.Rmd +++ b/inst/template/odt_template.Rmd @@ -35,7 +35,7 @@ library(knitr) testSVY %>% create_op() %>% - estimate_op_all(w = testPSU, indicators = "demo", replicates = 19) %>% + estimate_op(w = testPSU, indicators = "demo", replicates = 19) %>% select(LABEL:UCL.ALL) %>% kable() ``` diff --git a/inst/template/word_template.Rmd b/inst/template/word_template.Rmd index 8c04546..1fdcc87 100644 --- a/inst/template/word_template.Rmd +++ b/inst/template/word_template.Rmd @@ -36,13 +36,13 @@ library(knitr) testSVY %>% create_op() %>% - estimate_op_all(w = testPSU, indicators = "demo", replicates = 19) %>% + estimate_op(w = testPSU, indicators = "demo", replicates = 19) %>% select(LABEL:UCL.FEMALES) %>% kable(digits = 2) ``` ```{r respondentTable} -resultsDF <- estimate_op_all(x = indicators.ALL, w = testPSU, indicators = "demo", replicates = 19) %>% +resultsDF <- estimate_op(x = indicators.ALL, w = testPSU, indicators = "demo", replicates = 19) %>% select(LABEL:UCL.FEMALES) knitr::kable(x = resultsDF) diff --git a/man/chart_op.Rd b/man/chart_op.Rd index d7139da..f5a51eb 100644 --- a/man/chart_op.Rd +++ b/man/chart_op.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/07-chart.R +% Please edit documentation in R/06-chart.R \name{chart_op_age} \alias{chart_op_age} \alias{chart_op_muac} @@ -56,10 +56,7 @@ The respective plot in PNG format saved in the specified path if plot is shown on current graphics device } \description{ -Plot RAM-OP indicators -} -\section{The plots include}{ - +The plots include: \itemize{ \item Age by sex (pyramid plot) - a wrapper function to the \code{\link[=pyramid_plot]{pyramid_plot()}} function to create an age by sex pyramid plot @@ -75,7 +72,6 @@ function to create an age by sex pyramid plot \item Plot of income indicators } } - \examples{ # Create age by sex pyramid plot using indicators.ALL dataset chart_op_age(x = indicators.ALL) diff --git a/man/create_op.Rd b/man/create_op.Rd index 4af50d2..f4316ff 100644 --- a/man/create_op.Rd +++ b/man/create_op.Rd @@ -18,8 +18,7 @@ \alias{create_op_visual} \alias{create_op_misc} \title{Create older people indicators dataset from survey data collected using the -standard RAM-OP questionnaire. The indicator sets covered by the standard -RAM-OP survey are:} +standard RAM-OP questionnaire.} \usage{ create_op( svy, @@ -75,15 +74,28 @@ Default is \emph{"mf"} for both sexes.} A tibble of older people indicators } \description{ -Create older people indicators dataset from survey data collected using the -standard RAM-OP questionnaire. The indicator sets covered by the standard -RAM-OP survey are: +The indicator sets covered by the standard RAM-OP survey are: +\itemize{ +\item Demographic indicators +\item Dietary intake indicators +\item Household hunger scale +\item Katz Index of Independence in Activities of Daily Living score +\item K6 Short form psychological distress score +\item Brief Community Screening Instrument for Dementia (CSID) +\item Health and health-seeking indicators +\item Income and income sources +\item Water, sanitation and hygiene (WASH) indicators +\item Anthropometry and screening +\item Visual impairment by "Tumbling E" method +\item Miscellaneous indicators +\item Washington Group on Disability +} } \section{Demographic indicators}{ \tabular{ll}{ \strong{Variable} \tab \strong{Description} \cr - `psu`` \tab Primary sampling unit \cr - `resp1`` \tab Respondent is SUBJECT \cr + \code{psu} \tab Primary sampling unit \cr + \code{resp1} \tab Respondent is SUBJECT \cr \code{resp2} \tab Respondent is FAMILY CARER \cr \code{resp3} \tab Respondent is OTHER CARER \cr \code{resp4} \tab Respondent is OTHER \cr @@ -118,9 +130,9 @@ Household and Individual Dietary Diversity. Rome, FAO and extended to include indicators of probable adequate intake of a number of nutrients / micronutrients.\tabular{ll}{ \strong{Variable} \tab \strong{Description} \cr - `MF`` \tab Meal frequency \cr - `DDS`` \tab Dietary Diversity Score (count of 11 groups) \cr - `FG01`` \tab Cereals \cr + \code{MF} \tab Meal frequency \cr + \code{DDS} \tab Dietary Diversity Score (count of 11 groups) \cr + \code{FG01} \tab Cereals \cr \code{FG02} \tab Roots and tubers \cr \code{FG03} \tab Fruits and vegetables \cr \code{FG04} \tab All meat \cr @@ -183,18 +195,18 @@ of the index of ADL. The Gerontologist, 10(1), 20-30 mobility and instrumental activities of daily living. JAGS, 31(12), 721-726 \doi{10.1111/j.1532-5415.1983.tb03391.x}}\tabular{ll}{ \strong{Variable} \tab \strong{Description} \cr - ADL01 \tab Bathing \cr - ADL02 \tab Dressing \cr - ADL03 \tab Toileting \cr - ADL04 \tab Transferring (mobility) \cr - ADL05 \tab Continence \cr - ADL06 \tab Feeding \cr - scoreADL \tab ADL Score \cr - classADL1 \tab Severity of dependence 1 \cr - classADL2 \tab Severity of dependence 2 \cr - classADL3 \tab Severity of dependence 3 \cr - hasHelp \tab Have someone to help with everyday activities \cr - unmetNeed \tab Need help but has no helper \cr + \code{ADL01} \tab Bathing \cr + \code{ADL02} \tab Dressing \cr + \code{ADL03} \tab Toileting \cr + \code{ADL04} \tab Transferring (mobility) \cr + \code{ADL05} \tab Continence \cr + \code{ADL06} \tab Feeding \cr + \code{scoreADL} \tab ADL Score \cr + \code{classADL1} \tab Severity of dependence 1 \cr + \code{classADL2} \tab Severity of dependence 2 \cr + \code{classADL3} \tab Severity of dependence 3 \cr + \code{hasHelp} \tab Have someone to help with everyday activities \cr + \code{unmetNeed} \tab Need help but has no helper \cr } } @@ -208,8 +220,8 @@ et al. (2002). Short screening scales to monitor population prevalences and trends in non-specific psychological distress. Psychological Medicine, 32(6), 959–976 \doi{10.1017/S0033291702006074}}\tabular{ll}{ \strong{Variable} \tab \strong{Description} \cr - K6 \tab K6 score \cr - K6Case \tab K6 score > 12 (in serious psychological distress) \cr + \code{K6} \tab K6 score \cr + \code{K6Case} \tab K6 score > 12 (in serious psychological distress) \cr } } @@ -224,51 +236,51 @@ derivation and validation of the brief Community Screening Instrument for Dementia. International Journal of Geriatric Psychiatry, 26(9), 899–907 \doi{10.1002/gps.2622}}\tabular{ll}{ \strong{Variable} \tab \strong{Description} \cr - DS \tab Probable dementia by CSID screen \cr + \code{DS} \tab Probable dementia by CSID screen \cr } } \section{Health and health-seeking indicators}{ \tabular{ll}{ \strong{Variable} \tab \strong{Description} \cr - H1 \tab Chronic condition \cr - H2 \tab Takes drugs regularly for chronic condition \cr - H31 \tab No drugs available \cr - H32 \tab Too expensive / no money \cr - H33 \tab Too old to look for care \cr - H34 \tab Use traditional medicine \cr - H35 \tab Drugs don't help \cr - H36 \tab No-one to help me \cr - H37 \tab No need \cr - H38 \tab Other \cr - H39 \tab No reason given \cr - H4 \tab Recent disease episode \cr - H5 \tab Accessed care for recent disease episode \cr - H61 \tab No drugs available \cr - H62 \tab Too expensive / no money \cr - H63 \tab Too old to look for care \cr - H64 \tab Use traditional medicine \cr - H65 \tab Drugs don't help \cr - H66 \tab No-one to help me \cr - H67 \tab No need \cr - H68 \tab Other \cr - H69 \tab No reason given \cr + \code{H1} \tab Chronic condition \cr + \code{H2} \tab Takes drugs regularly for chronic condition \cr + \code{H31} \tab No drugs available \cr + \code{H32} \tab Too expensive / no money \cr + \code{H33} \tab Too old to look for care \cr + \code{H34} \tab Use traditional medicine \cr + \code{H35} \tab Drugs don't help \cr + \code{H36} \tab No-one to help me \cr + \code{H37} \tab No need \cr + \code{H38} \tab Other \cr + \code{H39} \tab No reason given \cr + \code{H4} \tab Recent disease episode \cr + \code{H5} \tab Accessed care for recent disease episode \cr + \code{H61} \tab No drugs available \cr + \code{H62} \tab Too expensive / no money \cr + \code{H63} \tab Too old to look for care \cr + \code{H64} \tab Use traditional medicine \cr + \code{H65} \tab Drugs don't help \cr + \code{H66} \tab No-one to help me \cr + \code{H67} \tab No need \cr + \code{H68} \tab Other \cr + \code{H69} \tab No reason given \cr } } \section{Income and income sources}{ \tabular{ll}{ \strong{Variable} \tab \strong{Description} \cr - M1 \tab Has a personal income \cr - M2A \tab Agriculture / fishing / livestock \cr - M2B \tab Wages / salary \cr - M2C \tab Sale of charcoal / bricks / etc. \cr - M2D \tab Trading (e.g. market or shop) \cr - M2E \tab Investments \cr - M2F \tab Spending savings / sale of assets \cr - M2G \tab Charity \cr - M2H \tab Cash transfer / Social security \cr - M2I \tab Other \cr + \code{M1} \tab Has a personal income \cr + \code{M2A} \tab Agriculture / fishing / livestock \cr + \code{M2B} \tab Wages / salary \cr + \code{M2C} \tab Sale of charcoal / bricks / etc. \cr + \code{M2D} \tab Trading (e.g. market or shop) \cr + \code{M2E} \tab Investments \cr + \code{M2F} \tab Spending savings / sale of assets \cr + \code{M2G} \tab Charity \cr + \code{M2H} \tab Cash transfer / Social security \cr + \code{M2I} \tab Other \cr } } @@ -281,19 +293,19 @@ These are a (core) subset of indicators from: for Household Surveys. Geneva, WHO / UNICEF \url{http://www.who.int/water_sanitation_health/monitoring/household_surveys/en/}}\tabular{ll}{ \strong{Variable} \tab \strong{Description} \cr - W1 \tab Improved source of drinking water \cr - W2 \tab Safe drinking water (improved source OR adequate treatment) \cr - W3 \tab Improved sanitation facility \cr - W4 \tab Improved non-shared sanitation facility \cr + \code{W1} \tab Improved source of drinking water \cr + \code{W2} \tab Safe drinking water (improved source OR adequate treatment) \cr + \code{W3} \tab Improved sanitation facility \cr + \code{W4} \tab Improved non-shared sanitation facility \cr } } \section{Anthropometry and screening}{ \tabular{ll}{ \strong{Variable} \tab \strong{Description} \cr - MUAC \tab Mid-upper arm circumference (mm) \cr - oedema \tab Bilateral pitting oedema (may not be nutritional) \cr - screened \tab Either MUAC or oedema checked previously \cr + \code{MUAC} \tab Mid-upper arm circumference (mm) \cr + \code{oedema} \tab Bilateral pitting oedema (may not be nutritional) \cr + \code{screened} \tab Either MUAC or oedema checked previously \cr } } @@ -312,9 +324,9 @@ an illiterate E Chart. Am J Optom & Physiol Optics 55:348}\tabular{ll}{ \section{Miscellaneous indicators}{ \tabular{ll}{ \strong{Variable} \tab \strong{Description} \cr - chew \tab Problems chewing food \cr - food \tab Anyone in HH receives a ration \cr - NFRI \tab Anyone in HH received non-food relief item/s (NFRI) in previous month \cr + \code{chew} \tab Problems chewing food \cr + \code{food} \tab Anyone in HH receives a ration \cr + \code{NFRI} \tab Anyone in HH received non-food relief item/s (NFRI) in previous month \cr } } @@ -328,35 +340,35 @@ See: for details.\tabular{ll}{ \strong{Variable} \tab \strong{Description} \cr - wgVisionD0 \tab Vision domain 0 \cr - wgVisionD1 \tab Vision domain 1 \cr - wgVisionD2 \tab Vision domain 2 \cr - wgVisionD3 \tab Vision domain 3 \cr - wgHearingD0 \tab Hearing domain 0 \cr - wgHearingD1 \tab Hearing domain 1 \cr - wgHearingD2 \tab Hearing domain 2 \cr - wgHearingD3 \tab Hearing domain 3 \cr - wgMobilityD0 \tab Mobility domain 0 \cr - wgMobilityD1 \tab Mobility domain 1 \cr - wgMobilityD2 \tab Mobility domain 2 \cr - wgMobilityD3 \tab Mobility domain 3 \cr - wgRememberingD0 \tab Remembering domain 0 \cr - wgRememberingD1 \tab Remembering domain 1 \cr - wgRememberingD2 \tab Remembering domain 2 \cr - wgRememberingD3 \tab Remembering domain 3 \cr - wgSelfCareD0 \tab Self-care domain 0 \cr - wgSelfCareD1 \tab Self-care domain 1 \cr - wgSelfCareD2 \tab Self-care domain 2 \cr - wgSelfCareD3 \tab Self-care domain 3 \cr - wgCommunicatingD0 \tab Communication domain 0 \cr - wgCommunicatingD1 \tab Communication domain 1 \cr - wgCommunicatingD2 \tab Communication domain 2 \cr - wgCommunicatingD3 \tab Communication domain 3 \cr - wgP0 \tab Overall 0 \cr - wgP1 \tab Overall 1 \cr - wgP2 \tab Overall 2 \cr - wgP3 \tab Overall 3 \cr - wgPM \tab Any disability \cr + \code{wgVisionD0} \tab Vision domain 0 \cr + \code{wgVisionD1} \tab Vision domain 1 \cr + \code{wgVisionD2} \tab Vision domain 2 \cr + \code{wgVisionD3} \tab Vision domain 3 \cr + \code{wgHearingD0} \tab Hearing domain 0 \cr + \code{wgHearingD1} \tab Hearing domain 1 \cr + \code{wgHearingD2} \tab Hearing domain 2 \cr + \code{wgHearingD3} \tab Hearing domain 3 \cr + \code{wgMobilityD0} \tab Mobility domain 0 \cr + \code{wgMobilityD1} \tab Mobility domain 1 \cr + \code{wgMobilityD2} \tab Mobility domain 2 \cr + \code{wgMobilityD3} \tab Mobility domain 3 \cr + \code{wgRememberingD0} \tab Remembering domain 0 \cr + \code{wgRememberingD1} \tab Remembering domain 1 \cr + \code{wgRememberingD2} \tab Remembering domain 2 \cr + \code{wgRememberingD3} \tab Remembering domain 3 \cr + \code{wgSelfCareD0} \tab Self-care domain 0 \cr + \code{wgSelfCareD1} \tab Self-care domain 1 \cr + \code{wgSelfCareD2} \tab Self-care domain 2 \cr + \code{wgSelfCareD3} \tab Self-care domain 3 \cr + \code{wgCommunicatingD0} \tab Communication domain 0 \cr + \code{wgCommunicatingD1} \tab Communication domain 1 \cr + \code{wgCommunicatingD2} \tab Communication domain 2 \cr + \code{wgCommunicatingD3} \tab Communication domain 3 \cr + \code{wgP0} \tab Overall 0 \cr + \code{wgP1} \tab Overall 1 \cr + \code{wgP2} \tab Overall 2 \cr + \code{wgP3} \tab Overall 3 \cr + \code{wgPM} \tab Any disability \cr } } @@ -364,5 +376,7 @@ for details.\tabular{ll}{ # Create indicators dataset from RAM-OP survey data collected from # Addis Ababa, Ethiopia create_op(testSVY) +create_op(testSVY, indicators = "demo") +create_op(testSVY, indicators = "hunger", sex = "m") } diff --git a/man/estimate_classic.Rd b/man/estimate_classic.Rd index caaba9d..614eb52 100644 --- a/man/estimate_classic.Rd +++ b/man/estimate_classic.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/03-classicBoot.R +% Please edit documentation in R/02-classicBoot.R \name{estimate_classic} \alias{estimate_classic} \title{Apply bootstrap to RAM-OP indicators using a classical estimator.} diff --git a/man/estimate_op_all.Rd b/man/estimate_op.Rd similarity index 86% rename from man/estimate_op_all.Rd rename to man/estimate_op.Rd index 294a65c..8a74d32 100644 --- a/man/estimate_op_all.Rd +++ b/man/estimate_op.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/06-estimate_op.R -\name{estimate_op_all} -\alias{estimate_op_all} +% Please edit documentation in R/05-estimate_op.R +\name{estimate_op} +\alias{estimate_op} \title{Estimate all standard RAM-OP indicators} \usage{ -estimate_op_all( +estimate_op( x, w, indicators = c("demo", "anthro", "food", "hunger", "adl", "disability", "mental", @@ -33,6 +33,6 @@ Tibble of boot estimates for all specified standard RAM-OP indicators Estimate all standard RAM-OP indicators } \examples{ -estimate_op_all(x = create_op(testSVY), w = testPSU, replicates = 9) +estimate_op(x = create_op(testSVY), w = testPSU, replicates = 9) } diff --git a/man/estimate_probit.Rd b/man/estimate_probit.Rd index f8c02d7..f478d67 100644 --- a/man/estimate_probit.Rd +++ b/man/estimate_probit.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/04-probitBoot.R +% Please edit documentation in R/03-probitBoot.R \name{estimate_probit} \alias{estimate_probit} \title{Apply bootstrap to RAM-OP indicators using a PROBIT estimator.} diff --git a/man/merge_estimates.Rd b/man/merge_estimates.Rd index 9d55159..f5f4a7b 100644 --- a/man/merge_estimates.Rd +++ b/man/merge_estimates.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/02-merge.R +% Please edit documentation in R/utils.R \name{merge_estimates} \alias{merge_estimates} \title{Concatenate classic and PROBIT estimates into a single data.frame} diff --git a/man/probit.Rd b/man/probit.Rd index 52382a7..475eebe 100644 --- a/man/probit.Rd +++ b/man/probit.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/05-probit_muac.R +% Please edit documentation in R/04-probit_muac.R \name{probit_gam} \alias{probit_gam} \alias{probit_sam} diff --git a/man/pyramid_plot.Rd b/man/pyramid_plot.Rd index b657c21..b0125b7 100644 --- a/man/pyramid_plot.Rd +++ b/man/pyramid_plot.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/08-pyramidPlot.R +% Please edit documentation in R/07-pyramidPlot.R \name{pyramid_plot} \alias{pyramid_plot} \title{Function to create a pyramid plot} diff --git a/man/report_op_adl.Rd b/man/report_op_adl.Rd index 12b5287..ca6fa0f 100644 --- a/man/report_op_adl.Rd +++ b/man/report_op_adl.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/09-report.R +% Please edit documentation in R/08-report.R \name{report_op_adl} \alias{report_op_adl} \title{Create a report chunk for activities of daily living indicators} diff --git a/man/report_op_anthro.Rd b/man/report_op_anthro.Rd index 545790a..bb6e65f 100644 --- a/man/report_op_anthro.Rd +++ b/man/report_op_anthro.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/09-report.R +% Please edit documentation in R/08-report.R \name{report_op_anthro} \alias{report_op_anthro} \title{Create a report chunk for anthropometric indicators} diff --git a/man/report_op_dementia.Rd b/man/report_op_dementia.Rd index e453ea9..d2741e0 100644 --- a/man/report_op_dementia.Rd +++ b/man/report_op_dementia.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/09-report.R +% Please edit documentation in R/08-report.R \name{report_op_dementia} \alias{report_op_dementia} \title{Create a report chunk for dementia indicators} diff --git a/man/report_op_demo.Rd b/man/report_op_demo.Rd index 0abb83b..7aefe64 100644 --- a/man/report_op_demo.Rd +++ b/man/report_op_demo.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/09-report.R +% Please edit documentation in R/08-report.R \name{report_op_demo} \alias{report_op_demo} \title{Create a report chunk for demography indicators} diff --git a/man/report_op_disability.Rd b/man/report_op_disability.Rd index 7238f87..f949fdd 100644 --- a/man/report_op_disability.Rd +++ b/man/report_op_disability.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/09-report.R +% Please edit documentation in R/08-report.R \name{report_op_disability} \alias{report_op_disability} \title{Create a report chunk for disability indicators} diff --git a/man/report_op_docx.Rd b/man/report_op_docx.Rd index 8c042ec..c44d7df 100644 --- a/man/report_op_docx.Rd +++ b/man/report_op_docx.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/09-report.R +% Please edit documentation in R/08-report.R \name{report_op_docx} \alias{report_op_docx} \title{Create a DOCX report document containing RAM-OP survey results} diff --git a/man/report_op_food.Rd b/man/report_op_food.Rd index e64818f..8d47bd6 100644 --- a/man/report_op_food.Rd +++ b/man/report_op_food.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/09-report.R +% Please edit documentation in R/08-report.R \name{report_op_food} \alias{report_op_food} \title{Create a report chunk for food indicators} diff --git a/man/report_op_health.Rd b/man/report_op_health.Rd index 23b4de1..d97ba17 100644 --- a/man/report_op_health.Rd +++ b/man/report_op_health.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/09-report.R +% Please edit documentation in R/08-report.R \name{report_op_health} \alias{report_op_health} \title{Create a report chunk for health and health-seeking behaviour indicators} diff --git a/man/report_op_html.Rd b/man/report_op_html.Rd index bd9a209..fc6cc7a 100644 --- a/man/report_op_html.Rd +++ b/man/report_op_html.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/09-report.R +% Please edit documentation in R/08-report.R \name{report_op_html} \alias{report_op_html} \title{Create an HTML report document containing RAM-OP survey results} diff --git a/man/report_op_hunger.Rd b/man/report_op_hunger.Rd index 6126a00..71d4c7a 100644 --- a/man/report_op_hunger.Rd +++ b/man/report_op_hunger.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/09-report.R +% Please edit documentation in R/08-report.R \name{report_op_hunger} \alias{report_op_hunger} \title{Create a report chunk for activities of food security indicators} diff --git a/man/report_op_income.Rd b/man/report_op_income.Rd index 2dd2f04..5e97967 100644 --- a/man/report_op_income.Rd +++ b/man/report_op_income.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/09-report.R +% Please edit documentation in R/08-report.R \name{report_op_income} \alias{report_op_income} \title{Create a report chunk for income} diff --git a/man/report_op_mental.Rd b/man/report_op_mental.Rd index ab18c9f..2677f30 100644 --- a/man/report_op_mental.Rd +++ b/man/report_op_mental.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/09-report.R +% Please edit documentation in R/08-report.R \name{report_op_mental} \alias{report_op_mental} \title{Create a report chunk for mental health indicators} diff --git a/man/report_op_misc.Rd b/man/report_op_misc.Rd index 58eecfc..608de3d 100644 --- a/man/report_op_misc.Rd +++ b/man/report_op_misc.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/09-report.R +% Please edit documentation in R/08-report.R \name{report_op_misc} \alias{report_op_misc} \title{Create a report chunk for miscellaneous indicators} diff --git a/man/report_op_odt.Rd b/man/report_op_odt.Rd index c897638..56c80ca 100644 --- a/man/report_op_odt.Rd +++ b/man/report_op_odt.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/09-report.R +% Please edit documentation in R/08-report.R \name{report_op_odt} \alias{report_op_odt} \title{Create a ODT report document containing RAM-OP survey results} diff --git a/man/report_op_oedema.Rd b/man/report_op_oedema.Rd index b3dffcd..f923b4f 100644 --- a/man/report_op_oedema.Rd +++ b/man/report_op_oedema.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/09-report.R +% Please edit documentation in R/08-report.R \name{report_op_oedema} \alias{report_op_oedema} \title{Create a report chunk for oedema} diff --git a/man/report_op_screen.Rd b/man/report_op_screen.Rd index d853444..c56902a 100644 --- a/man/report_op_screen.Rd +++ b/man/report_op_screen.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/09-report.R +% Please edit documentation in R/08-report.R \name{report_op_screen} \alias{report_op_screen} \title{Create a report chunk for screening indicators} diff --git a/man/report_op_table.Rd b/man/report_op_table.Rd index 5abe69f..6bc1d21 100644 --- a/man/report_op_table.Rd +++ b/man/report_op_table.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/09-report.R +% Please edit documentation in R/08-report.R \name{report_op_table} \alias{report_op_table} \title{Create table of RAM-OP results} diff --git a/man/report_op_visual.Rd b/man/report_op_visual.Rd index cd22452..d1c58f5 100644 --- a/man/report_op_visual.Rd +++ b/man/report_op_visual.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/09-report.R +% Please edit documentation in R/08-report.R \name{report_op_visual} \alias{report_op_visual} \title{Create a report chunk for visual acuity} diff --git a/man/report_op_wash.Rd b/man/report_op_wash.Rd index fcbb02d..799b9aa 100644 --- a/man/report_op_wash.Rd +++ b/man/report_op_wash.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/09-report.R +% Please edit documentation in R/08-report.R \name{report_op_wash} \alias{report_op_wash} \title{Create a report chunk for water, sanitation and hygiene} diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml index 8903a68..77fd8fd 100644 --- a/pkgdown/_pkgdown.yml +++ b/pkgdown/_pkgdown.yml @@ -83,11 +83,9 @@ reference: - title: Utility/support functions contents: - - fullTable - - get_variables - - merge_estimates - probit_gam - probit_sam + - merge_estimates - title: Datasets contents: diff --git a/tests/testthat/test-08-estimate_op.R b/tests/testthat/test-08-estimate_op.R index 61cb0b1..fa8673a 100644 --- a/tests/testthat/test-08-estimate_op.R +++ b/tests/testthat/test-08-estimate_op.R @@ -1,5 +1,5 @@ -test <- estimate_op_all(x = indicators.ALL, w = testPSU, replicates = 19) +test <- estimate_op(x = indicators.ALL, w = testPSU, replicates = 19) test_that("output has 139 rows", { expect_equal(nrow(test), 139) @@ -10,7 +10,7 @@ test_that("output has 10 columns", { }) -test <- estimate_op_all(x = indicators.ALL, w = testPSU, indicators = "demo", replicates = 19) +test <- estimate_op(x = indicators.ALL, w = testPSU, indicators = "demo", replicates = 19) test_that("output has 19 rows", { expect_equal(nrow(test), 19) @@ -21,7 +21,7 @@ test_that("output has 10 columns", { }) -test <- estimate_op_all(x = indicators.ALL, w = testPSU, indicators = "anthro", replicates = 19) +test <- estimate_op(x = indicators.ALL, w = testPSU, indicators = "anthro", replicates = 19) test_that("output has 3 rows", { expect_equal(nrow(test), 3) diff --git a/tests/testthat/test-10-report.R b/tests/testthat/test-10-report.R index f3d987c..e887169 100644 --- a/tests/testthat/test-10-report.R +++ b/tests/testthat/test-10-report.R @@ -1,12 +1,12 @@ -report_op_table(estimate_op_all(x = indicators.ALL, w = testPSU, replicates = 19), +report_op_table(estimate_op(x = indicators.ALL, w = testPSU, replicates = 19), filename = paste(tempdir(), "TEST", sep = "/")) test_that("output file exists", { expect_true(file.exists(paste(tempdir(), "TEST.report.csv", sep = "/"))) }) -report_op_html(estimates = estimate_op_all(x = indicators.ALL, +report_op_html(estimates = estimate_op(x = indicators.ALL, w = testPSU, replicates = 19), svy = testSVY, @@ -18,7 +18,7 @@ test_that("output file exists", { }) -report_op_docx(estimates = estimate_op_all(x = indicators.ALL, +report_op_docx(estimates = estimate_op(x = indicators.ALL, w = testPSU, replicates = 19), svy = testSVY, @@ -30,7 +30,7 @@ test_that("output file exists", { }) -report_op_odt(estimates = estimate_op_all(x = indicators.ALL, +report_op_odt(estimates = estimate_op(x = indicators.ALL, w = testPSU, replicates = 19), svy = testSVY, diff --git a/vignettes/ram_op_workflow.Rmd b/vignettes/ram_op_workflow.Rmd index f27b9c4..f260acf 100644 --- a/vignettes/ram_op_workflow.Rmd +++ b/vignettes/ram_op_workflow.Rmd @@ -356,7 +356,7 @@ and will look something like this: ```{r showTable, echo = FALSE, eval = TRUE} read.csv( - file = paste(tempdir(), "TEST.report.csv", sep = "/"), + file = file.path(tempdir(), "TEST.report.csv"), stringsAsFactors = FALSE ) ``` @@ -370,7 +370,7 @@ The `oldr` package functions were designed in such a way that they can be piped ```{r estimatePipe1, echo = TRUE, eval = TRUE} testSVY |> create_op() |> - estimate_op_all(w = testPSU, replicates = 9) |> + estimate_op(w = testPSU, replicates = 9) |> report_op_table(filename = file.path(tempdir(), "TEST")) ``` @@ -396,7 +396,7 @@ If the preferred output is a report with combined charts and tables of results, ```{r estimateReport1, echo = TRUE, eval = FALSE} testSVY |> create_op() |> - estimate_op_all(w = testPSU, replicates = 9) |> + estimate_op(w = testPSU, replicates = 9) |> report_op_html( svy = testSVY, filename = file.path(tempdir(), "ramOPreport") )