Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev to main #76

Merged
merged 43 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
b43f45b
refactor age wranglers (1/2)
tomaszaba Oct 24, 2024
23d4b03
refactor age wranglers (2/2)
tomaszaba Oct 24, 2024
06b6140
refactor wranglers (2/3)
tomaszaba Oct 25, 2024
f99e9a5
refactor wranglers
tomaszaba Oct 26, 2024
0d6f1e7
refactor wranglers (age)
tomaszaba Oct 26, 2024
ce66f66
Merge pull request #56 from nutriverse/wrangledata
tomaszaba Oct 26, 2024
d0f1890
refactor data wranglers
tomaszaba Oct 27, 2024
3782efc
fix bug in NSA of functions
tomaszaba Oct 27, 2024
ca5d287
Fix inconsistent use of NSE
tomaszaba Oct 27, 2024
21333df
address reviews
tomaszaba Oct 27, 2024
4b7edfd
Final set of requested reviews
tomaszaba Oct 28, 2024
a731f3c
Final tweaks
tomaszaba Oct 30, 2024
17f63c0
Merge pull request #57 from nutriverse/wrangle_data
tomaszaba Oct 31, 2024
5456d88
use more standard knitr option for README; fix #65
ernestguevarra Oct 31, 2024
8f61ea1
update README
ernestguevarra Oct 31, 2024
3b6c8c0
Change package name
tomaszaba Oct 31, 2024
9c82a5f
Change syntax --> examples
tomaszaba Oct 31, 2024
6f55803
Refactor quality raters
tomaszaba Oct 31, 2024
a6e53fb
Refactor quality scorers
tomaszaba Oct 31, 2024
4cbc6d5
add pre-allocated Zenodo badge; fix #69
ernestguevarra Nov 1, 2024
16d0e21
update hex sticker; fix #31
ernestguevarra Nov 1, 2024
57b8870
update hex sticker
ernestguevarra Nov 1, 2024
36ad7f0
Add hex sticker
tomaszaba Nov 1, 2024
5b78105
Add `regex` in all testthat::expect_error()
tomaszaba Nov 2, 2024
4549228
Re-factor, doc, test plausibility checkers
tomaszaba Nov 2, 2024
d45350a
Refactor plausibility checkers
tomaszaba Nov 2, 2024
1d59b19
Tweaks
tomaszaba Nov 2, 2024
f9df610
use more standard knitr option for README; fix #65
ernestguevarra Oct 31, 2024
fc1ead8
update README
ernestguevarra Oct 31, 2024
31a7d45
add pre-allocated Zenodo badge; fix #69
ernestguevarra Nov 1, 2024
3ecf177
update hex sticker; fix #31
ernestguevarra Nov 1, 2024
32080a4
update hex sticker
ernestguevarra Nov 1, 2024
13eacc4
Change package name
tomaszaba Oct 31, 2024
317db43
change testthat.R file specification to mwana
ernestguevarra Nov 3, 2024
d5d97e6
add dev as a testing branch for push and PR
ernestguevarra Nov 3, 2024
3d61bc9
Apply styler::style_file()
tomaszaba Nov 3, 2024
3d3e550
Fix conflict
tomaszaba Nov 3, 2024
c0c5f23
Merge pull request #70 from nutriverse/ScorerRater
tomaszaba Nov 3, 2024
c077aa5
Re-factor ipc check function
tomaszaba Nov 3, 2024
0a57f14
Remove sysdata.rda
tomaszaba Nov 4, 2024
4f86ea3
Merge pull request #72 from nutriverse/ipc-check
tomaszaba Nov 4, 2024
dd6851a
Update package version
tomaszaba Nov 4, 2024
12462fe
Update _pkgdown.yml
tomaszaba Nov 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
^ipccheckr\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
^README\.Rmd$
Expand All @@ -14,6 +13,9 @@
^README_files$
^mwana\.Rproj$
^vignettes/plausibility_files$
ˆvingettes/plausibility.html$
^vignettes/prevalence_files$
ˆvignettes/prevalence.html$
^vignettes/sample_size_files$
ˆvignettes/sample_size.html$
^CODE_OF_CONDUCT\.md$
4 changes: 2 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
branches: [main, dev]
pull_request:
branches: [main, master]
branches: [main, dev]

name: R-CMD-check

Expand Down
9 changes: 5 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: ipccheckr
Package: mwana
Title: Utilities for Analysing Children's Nutritional Status
Version: 0.0.0.9000
Version: 0.1.0.9000
Authors@R: c(
person("Tomás", "Zaba", , "tomas.zaba@outlook.com", role = c("aut", "cre", "cph"),
comment = c(ORCID = "0000-0002-7079-3574")),
Expand All @@ -12,7 +12,7 @@ Description: A streamlined and comprehensive implementation of the Standardized
Monitoring and Assessment of Relief and Transition (SMART) Methodology
<https://smartmethodology.org/> guidelines for data quality checks and
prevalence estimation, with enhanced programmable process particularly when
handling large multiple datasets.
handling multiple area datasets.
License: GPL (>= 3)
URL: https://github.com/nutriverse/mwana, https://nutriverse.io/mwana
Imports:
Expand All @@ -24,7 +24,8 @@ Imports:
srvyr,
stats,
zscorer,
tibble
tibble,
methods
Suggests:
knitr,
rmarkdown,
Expand Down
30 changes: 17 additions & 13 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Generated by roxygen2: do not edit by hand

export(age_ratio_test)
export(check_plausibility_mfaz)
export(check_plausibility_muac)
export(check_plausibility_wfhz)
export(check_sample_size)
export(classify_overall_quality)
export(compute_combined_prevalence)
export(compute_muac_prevalence)
export(compute_quality_score)
export(compute_wfhz_prevalence)
export(define_wasting)
export(flag_outliers)
export(generate_pretty_table_mfaz)
export(generate_pretty_table_muac)
export(generate_pretty_table_wfhz)
export(process_age)
export(process_muac_data)
export(process_wfhz_data)
export(get_age_months)
export(mw_check_ipcamn_ssreq)
export(mw_neat_output_mfaz)
export(mw_neat_output_muac)
export(mw_neat_output_wfhz)
export(mw_plausibility_check_mfaz)
export(mw_plausibility_check_muac)
export(mw_plausibility_check_wfhz)
export(mw_stattest_ageratio)
export(mw_wrangle_age)
export(mw_wrangle_muac)
export(mw_wrangle_wfhz)
export(recode_muac)
export(remove_flags)
importFrom(dplyr,across)
importFrom(dplyr,case_when)
importFrom(dplyr,ends_with)
Expand All @@ -31,12 +31,15 @@ importFrom(dplyr,n_distinct)
importFrom(dplyr,rename)
importFrom(dplyr,summarise)
importFrom(lubridate,ymd)
importFrom(methods,is)
importFrom(nipnTK,ageRatioTest)
importFrom(nipnTK,digitPreference)
importFrom(nipnTK,greensIndex)
importFrom(nipnTK,sexRatioTest)
importFrom(nipnTK,skewKurt)
importFrom(rlang,.data)
importFrom(rlang,enquo)
importFrom(rlang,eval_tidy)
importFrom(rlang,sym)
importFrom(scales,label_percent)
importFrom(scales,label_pvalue)
Expand All @@ -47,4 +50,5 @@ importFrom(stats,pnorm)
importFrom(stats,prop.test)
importFrom(stats,sd)
importFrom(stats,setNames)
importFrom(tibble,as_tibble)
importFrom(zscorer,addWGSR)
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# ipccheckr v0.0.0.9000 (development version)
# mwana v0.0.0.9000 (development version)

* Initial pre-release version for alpha-testing.
162 changes: 0 additions & 162 deletions R/age.R

This file was deleted.

72 changes: 72 additions & 0 deletions R/ipc_amn_check.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#'
#' Check whether IPC Acute Malnutrition (IPC AMN) sample size requirements were met
#'
#' @description
#' Evidence on the prevalence of acute malnutrition used in the IPC AMN
#' can come from different sources: surveys, screenings or community-based
#' surveillance system. The IPC set minimum sample size requirements
#' for each source. This function helps in verifying whether the requirements
#' were met or not depending on the source.
#'
#' @param df A dataset object of class `data.frame` to check.
#'
#' @param cluster A vector of class `integer` or `character` of unique cluster or
#' screening or sentinel site IDs. If a `character` vector, ensure that names are
#' correct and each name represents one location for accurate counts. If the class
#' does not match the above expected type, the function will stop execution and
#' return an error message indicating the type of mismatch.
#'
#' @param .source The source of evidence. A choice between "survey" for
#' representative survey data at the area of analysis; "screening" for
#' screening data; "ssite" for community-based sentinel site data.
#'
#' @returns A summary table of class `data.frame`, of length 3 and width 1, for
#' the check results. `n_clusters` is for the total number of unique clusters or
#' screening or site IDs; `n_obs` for the correspondent total number of children
#' in the dataset; and `meet_ipc` for whether the IPC AMN requirements were met.
#'
#' @references
#' IPC Global Partners. 2021. *Integrated Food Security Phase Classification*
#' *Technical Manual Version 3.1.Evidence and Standards for Better Food Security*
#' *and Nutrition Decisions*. Rome. Available at:
#' <https://www.ipcinfo.org/ipcinfo-website/resources/ipc-manual/en/>.
#'
#' @examples
#' mw_check_ipcamn_ssreq(
#' df = anthro.01,
#' cluster = cluster,
#' .source = "survey"
#' )
#'
#' @export
#'
mw_check_ipcamn_ssreq <- function(df,
cluster,
.source = c("survey", "screening", "ssite")) {
## Difuse and evaluate arguments ----
cluster <- eval_tidy(enquo(cluster), df)

## Enforce the options in `.source` ----
.source <- match.arg(.source)

## Enforce the class of `cluster` ----
if (!(class(cluster) %in% c("integer", "character"))) {
stop(
"`cluster` must be of class `integer` or `character`; not ", shQuote(class(cluster)), ". Please try again."
)
}

## Summarize ----
df <- df |>
summarise(
n_clusters = n_distinct({{ cluster }}),
n_obs = n(),
meet_ipc = case_when(
.source == "survey" & n_clusters >= 25 ~ "yes",
.source == "screening" & n_clusters >= 3 & n_obs >= 600 ~ "yes",
.source == "ssite" & n_clusters >= 5 & n_obs >= 200 ~ "yes",
.default = "no"
)
)
as_tibble(df)
}
8 changes: 6 additions & 2 deletions R/ipccheckr-package.R → R/mwana-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@

## usethis namespace: start
#' @importFrom dplyr across case_when group_by mutate n n_distinct rename summarise
#' @importFrom dplyr ends_with everything filter
#' @importFrom dplyr ends_with everything filter mutate
#' @importFrom dplyr group_by
#' @importFrom dplyr summarise
#' @importFrom lubridate ymd
#' @importFrom methods is
#' @importFrom nipnTK ageRatioTest digitPreference sexRatioTest skewKurt greensIndex
#' @importFrom rlang .data sym
#' @importFrom rlang .data sym enquo eval_tidy
#' @importFrom scales label_percent label_pvalue
#' @importFrom srvyr as_survey_design survey_mean
#' @importFrom stats na.omit prop.test sd pnorm setNames
#' @importFrom tibble as_tibble
#' @importFrom zscorer addWGSR
## usethis namespace: end
NULL
Loading
Loading