diff --git a/NEWS.md b/NEWS.md index d71a5bd..8e0b3d0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,11 +2,13 @@ Fourth release of `zscorer`. In this release: +* fixed an issue with wrong URLs in README documentation. + * fixed an issue when calculating BMI-for-age where measurements are 0 resulting in error rather than providing an NA value. Now, when values for measurements are 0, the zscore produced is NA. * updated MUAC for age to allow for calculation for children up to 19 years old based on article by Jay Berkeley and colleagues. -* updated Shiny app +* updated Shiny app and added a vignette showing how to use the Shiny app * updated documentation to reflect editions and additions diff --git a/README.Rmd b/README.Rmd index 992d366..66665dd 100644 --- a/README.Rmd +++ b/README.Rmd @@ -390,11 +390,11 @@ knitr::include_graphics("man/figures/zscorerApp.png") ## References -[^1]: World Health Organization (WHO). (2006). WHO Child Growth Standards: Length/height-for-age, weight-for-age, weight-for-length, weight-for-height and body mass index-for-age: Methods and development. [https://doi.org/10.1037/e569412006-008](https://doi.org/10.1037/e569412006-008) +[^1]: World Health Organization. (2006). WHO child growth standards : length/height-for-age, weight-for-age, weight-for-length, weight -for-height and body mass index-for-age : methods and development. World Health Organization. [https://apps.who.int/iris/handle/10665/43413](https://apps.who.int/iris/handle/10665/43413) -[^2]: World Health Organization (WHO). (2007). WHO Child Growth Standards: Head circumference-for-age, arm circumference-for-age, triceps skinfold-for-age and subscapular skinfold-for-age: methods and development. Geneva: World Health Organization. +[^2]: World Health Organization. (2007). WHO child growth standards : head circumference-for-age, arm circumference-for-age, triceps skinfold-for-age and subscapular skinfold-for-age : methods and development. World Health Organization. [https://apps.who.int/iris/handle/10665/43706](https://apps.who.int/iris/handle/10665/43706) -[^3]: Onis, M. De, Onyango, A. W., Borghi, E., Siyam, A., & Siekmann, J. (2007). Development of a WHO growth reference for school-aged children and adolescents. 043497(July), 660–667. [https://doi.org/10.2471/BLT](https://doi.org/10.2471/BLT). +[^3]: de Onis M. Development of a WHO growth reference for school-aged children and adolescents. Bull World Health Org. 2007;85: 660–667. [doi:10.2471/BLT.07.043497](https://doi.org/10.2471/blt.07.043497) [^4]: Mramba L, Ngari M, Mwangome M, Muchai L, Bauni E, Walker AS, et al. A growth reference for mid upper arm circumference for age among school age children and adolescents, and validation for mortality: growth curve construction and longitudinal cohort study. BMJ. 2017;: j3423–8. [doi:10.1136/bmj.j3423](https://doi.org/10.1136/bmj.j3423) diff --git a/README.md b/README.md index 4c33f27..d904e68 100644 --- a/README.md +++ b/README.md @@ -521,20 +521,21 @@ current device as shown below: ## References -1. World Health Organization (WHO). (2006). WHO Child Growth Standards: - Length/height-for-age, weight-for-age, weight-for-length, - weight-for-height and body mass index-for-age: Methods and - development. - -2. World Health Organization (WHO). (2007). WHO Child Growth Standards: - Head circumference-for-age, arm circumference-for-age, triceps - skinfold-for-age and subscapular skinfold-for-age: methods and - development. Geneva: World Health Organization. - -3. Onis, M. De, Onyango, A. W., Borghi, E., Siyam, A., & Siekmann, J. - (2007). Development of a WHO growth reference for school-aged - children and adolescents. 043497(July), 660–667. - . +1. World Health Organization. (2006). WHO child growth standards : + length/height-for-age, weight-for-age, weight-for-length, weight + -for-height and body mass index-for-age : methods and development. + World Health Organization. + + +2. World Health Organization. (2007). WHO child growth standards : head + circumference-for-age, arm circumference-for-age, triceps + skinfold-for-age and subscapular skinfold-for-age : methods and + development. World Health Organization. + + +3. de Onis M. Development of a WHO growth reference for school-aged + children and adolescents. Bull World Health Org. 2007;85: 660–667. + [doi:10.2471/BLT.07.043497](https://doi.org/10.2471/blt.07.043497) 4. Mramba L, Ngari M, Mwangome M, Muchai L, Bauni E, Walker AS, et al. A growth reference for mid upper arm circumference for age diff --git a/cran-comments.md b/cran-comments.md index 0819e23..b96c561 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,11 +1,13 @@ ## Release summary -Fourth release of `zscorer`. In this release: +Fourth release of `zscorer`. This is a re-submission to address issues noted by CRAN. In this release: + +* fixed an issue with wrong URLs in README documentation. * fixed an issue when calculating BMI-for-age where measurements are 0 resulting in error rather than providing an NA value. Now, when values for measurements are 0, the zscore produced is NA. * updated MUAC for age to allow for calculation for children up to 19 years old based on article by Jay Berkeley and colleagues. -* updated Shiny app +* updated Shiny app and added a vignette showing how to use the Shiny app * updated documentation to reflect editions and additions diff --git a/docs/404.html b/docs/404.html index f0895c3..f3065dc 100644 --- a/docs/404.html +++ b/docs/404.html @@ -108,6 +108,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html index 8214fe2..b6168de 100644 --- a/docs/LICENSE-text.html +++ b/docs/LICENSE-text.html @@ -108,6 +108,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • diff --git a/docs/articles/anthropometry.html b/docs/articles/anthropometry.html index 84598aa..6076f1e 100644 --- a/docs/articles/anthropometry.html +++ b/docs/articles/anthropometry.html @@ -68,6 +68,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • @@ -97,7 +100,7 @@

    WHO Child Growth Standards: Methods and Development

    World Health Organisation

    -

    2019-10-17

    +

    2019-10-19

    Source: vignettes/anthropometry.Rmd diff --git a/docs/articles/calculate_zscore.html b/docs/articles/calculate_zscore.html index 7ddfbe7..58eb60a 100644 --- a/docs/articles/calculate_zscore.html +++ b/docs/articles/calculate_zscore.html @@ -68,6 +68,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • @@ -97,7 +100,7 @@

    Calculating anthropometric z-scores using zscorer

    Mark Myatt

    -

    2019-10-17

    +

    2019-10-19

    Source: vignettes/calculate_zscore.Rmd diff --git a/docs/articles/index.html b/docs/articles/index.html index 26c84f5..c6ac527 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -108,6 +108,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • @@ -145,6 +148,7 @@

    All vignettes

  • WHO Child Growth Standards: Methods and Development
  • Calculating anthropometric z-scores using zscorer
  • Legacy functions
  • +
  • Using zscorer Shiny application
  • diff --git a/docs/articles/legacy_functions.html b/docs/articles/legacy_functions.html index bb56c75..9902a2e 100644 --- a/docs/articles/legacy_functions.html +++ b/docs/articles/legacy_functions.html @@ -68,6 +68,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • @@ -97,7 +100,7 @@

    Legacy functions

    Ernest Guevarra

    -

    2019-10-17

    +

    2019-10-19

    Source: vignettes/legacy_functions.Rmd diff --git a/docs/articles/using-shiny-app.html b/docs/articles/using-shiny-app.html new file mode 100644 index 0000000..f661a9c --- /dev/null +++ b/docs/articles/using-shiny-app.html @@ -0,0 +1,182 @@ + + + + + + + +Using zscorer Shiny application • zscorer + + + + + + + + + + +
    +
    + + + + +
    +
    + + + + +

    zscorer comes packaged with a built-in Shiny application. The application is initiated by issuing the following command:

    +

    This opens the installed web browser in the user’s device showing the following:

    +

    +
    +

    +Getting the z-score of a single child

    +

    The first (and default) functionality of the built-in Shiny application is for calculating the z-scores for a single child. This functionality is accessed by selecting the single option on the tabbed menu available in the top edge of the application interface as shown below:

    +

    +

    When this functionality is selected, the sidebar menu provides the following options:

    +

    +

    In this sidebar menu, the user should enter all the anthropometric measurements available for the child to whom user wants to calculate z-scores of. For the calculation to work, the minimum data needed to be supplied by the user are:

    +
      +
    • Age;

    • +
    • Sex; and,

    • +
    • At least one anthropometric measurement among weight (kgs), height (cms), mid-upper arm circumference (cms), head circumference (cms), subscapular skinfold (cms) or triceps skinfold (cms).

    • +
    +

    Please ensure that any anthropometric measurement is supplied in the appropriate units as indicated above.

    +

    To illustrate, let’s use the dummy data of a 52 month old male child with a weight of 14.6 kg and a height of 98.0 cm. This data is typed into the sidebar menu and then click on the Calculate tab as shown below:

    +

    +

    This produces the following output in the main panel of the application:

    +

    +

    Depending on the anthropometric measurements supplied, the corresponding applicable z-score indices will be provided. No z-score result will be provided if the required anthropometric measurement is not supplied. In the example above, MUAC-for-age, head circumference-for-age, subscapular skinfold-for-age and triceps skinfold-for-age are not provide as no MUAC, head circumference, subscapular skinfold or triceps skinfold are provided.

    +
    +
    +

    +Getting the z-score of a cohort of children

    +

    The second functionality of the built-in Shiny application is for calculating the z-scores for a cohort of children. This functionality is accessed by selecting the cohort option on the tabbed menu available in the top edge of the application interface as shown below:

    +

    +

    When this functionality is selected, the sidebar menu provides the following options:

    +

    +

    In this sidebar menu, the user is expected to upload cohort data of children with their anthropometric data. The user is also expected to select which anthropometric indices to calculate. If no anthropometric indices are selected, no calculations will be performed. A cohort data can be uploaded by clicking on the Browse button and then selecting the file with cohort data to upload. Once uploaded, the sidebar menu will provide the following additional options:

    +

    +

    For the zscorer app to be able to calculate z-scores from the cohort data, the variables corresponding to the required information needs to be supplied. By default, the application will search the variable names in the data and pick out typical variable names for the measurements (e.g., ht or height or HT or Height or HEIGHT for height measurements). If the variables are named unconventionally, user will have to select the variable name for the particular measurement from the choices. If the measurements are not in the data, then the variable field should be left empty.

    +

    Once the various parameters have been provided, user should click on the Calculate button which results in the following:

    +

    +

    The dataset provides is presented as a table in the main panel but now with additional fields for the calculated anthropometric indices. The resulting dataset with the calculated anthropometric indices can then be downloaded by clicking on the Download button.

    +
    +
    + + + +
    + + + +
    + +
    +

    Site built with pkgdown 1.4.1.

    +
    + +
    +
    + + + + + + diff --git a/docs/authors.html b/docs/authors.html index 728814b..c1b9649 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -108,6 +108,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • diff --git a/docs/index.html b/docs/index.html index bfca863..bfa2b50 100644 --- a/docs/index.html +++ b/docs/index.html @@ -72,6 +72,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • @@ -579,9 +582,9 @@

    References

      -
    1. World Health Organization (WHO). (2006). WHO Child Growth Standards: Length/height-for-age, weight-for-age, weight-for-length, weight-for-height and body mass index-for-age: Methods and development. https://doi.org/10.1037/e569412006-008

    2. -
    3. World Health Organization (WHO). (2007). WHO Child Growth Standards: Head circumference-for-age, arm circumference-for-age, triceps skinfold-for-age and subscapular skinfold-for-age: methods and development. Geneva: World Health Organization.

    4. -
    5. Onis, M. De, Onyango, A. W., Borghi, E., Siyam, A., & Siekmann, J. (2007). Development of a WHO growth reference for school-aged children and adolescents. 043497(July), 660–667. https://doi.org/10.2471/BLT.

    6. +
    7. World Health Organization. (2006). WHO child growth standards : length/height-for-age, weight-for-age, weight-for-length, weight -for-height and body mass index-for-age : methods and development. World Health Organization. https://apps.who.int/iris/handle/10665/43413

    8. +
    9. World Health Organization. (2007). WHO child growth standards : head circumference-for-age, arm circumference-for-age, triceps skinfold-for-age and subscapular skinfold-for-age : methods and development. World Health Organization. https://apps.who.int/iris/handle/10665/43706

    10. +
    11. de Onis M. Development of a WHO growth reference for school-aged children and adolescents. Bull World Health Org. 2007;85: 660–667. doi:10.2471/BLT.07.043497

    12. Mramba L, Ngari M, Mwangome M, Muchai L, Bauni E, Walker AS, et al. A growth reference for mid upper arm circumference for age among school age children and adolescents, and validation for mortality: growth curve construction and longitudinal cohort study. BMJ. 2017;: j3423–8. doi:10.1136/bmj.j3423

    diff --git a/docs/man/figures/cohort.png b/docs/man/figures/cohort.png new file mode 100644 index 0000000..adec215 Binary files /dev/null and b/docs/man/figures/cohort.png differ diff --git a/docs/man/figures/cohortResults.png b/docs/man/figures/cohortResults.png new file mode 100644 index 0000000..af47a58 Binary files /dev/null and b/docs/man/figures/cohortResults.png differ diff --git a/docs/man/figures/cohortSidebar.png b/docs/man/figures/cohortSidebar.png new file mode 100644 index 0000000..d232928 Binary files /dev/null and b/docs/man/figures/cohortSidebar.png differ diff --git a/docs/man/figures/sidebarCohortOptions.png b/docs/man/figures/sidebarCohortOptions.png new file mode 100644 index 0000000..de494e9 Binary files /dev/null and b/docs/man/figures/sidebarCohortOptions.png differ diff --git a/docs/man/figures/sidebarSingleInput.png b/docs/man/figures/sidebarSingleInput.png new file mode 100644 index 0000000..94c3dab Binary files /dev/null and b/docs/man/figures/sidebarSingleInput.png differ diff --git a/docs/man/figures/single.png b/docs/man/figures/single.png new file mode 100644 index 0000000..e7e9b28 Binary files /dev/null and b/docs/man/figures/single.png differ diff --git a/docs/man/figures/singleResults.png b/docs/man/figures/singleResults.png new file mode 100644 index 0000000..8395c67 Binary files /dev/null and b/docs/man/figures/singleResults.png differ diff --git a/docs/man/figures/singleSidebar.png b/docs/man/figures/singleSidebar.png new file mode 100644 index 0000000..30957bd Binary files /dev/null and b/docs/man/figures/singleSidebar.png differ diff --git a/docs/man/figures/zscorerApp.png b/docs/man/figures/zscorerApp.png new file mode 100644 index 0000000..c01ab71 Binary files /dev/null and b/docs/man/figures/zscorerApp.png differ diff --git a/docs/news/index.html b/docs/news/index.html index ff9f2a3..a669e9b 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -108,6 +108,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • @@ -144,9 +147,10 @@

    Fourth release of zscorer. In this release:

      +
    • fixed an issue with wrong URLs in README documentation.

    • fixed an issue when calculating BMI-for-age where measurements are 0 resulting in error rather than providing an NA value. Now, when values for measurements are 0, the zscore produced is NA.

    • updated MUAC for age to allow for calculation for children up to 19 years old based on article by Jay Berkeley and colleagues.

    • -
    • updated Shiny app

    • +
    • updated Shiny app and added a vignette showing how to use the Shiny app

    • updated documentation to reflect editions and additions

    diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 1af631c..10798bc 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -5,6 +5,7 @@ articles: anthropometry: anthropometry.html calculate_zscore: calculate_zscore.html legacy_functions: legacy_functions.html + using-shiny-app: using-shiny-app.html urls: reference: https://nutriverse.io/zscorer/reference article: https://nutriverse.io/zscorer/articles diff --git a/docs/reference/addWGSR.html b/docs/reference/addWGSR.html index 625189a..a58bab6 100644 --- a/docs/reference/addWGSR.html +++ b/docs/reference/addWGSR.html @@ -116,6 +116,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • diff --git a/docs/reference/anthro1.html b/docs/reference/anthro1.html index e0c87a4..55c7440 100644 --- a/docs/reference/anthro1.html +++ b/docs/reference/anthro1.html @@ -110,6 +110,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • diff --git a/docs/reference/anthro2.html b/docs/reference/anthro2.html index 7deb1d7..6d83f7d 100644 --- a/docs/reference/anthro2.html +++ b/docs/reference/anthro2.html @@ -113,6 +113,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • diff --git a/docs/reference/anthro3.html b/docs/reference/anthro3.html index 6f288df..3056062 100644 --- a/docs/reference/anthro3.html +++ b/docs/reference/anthro3.html @@ -110,6 +110,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • diff --git a/docs/reference/anthro4.html b/docs/reference/anthro4.html index bc18c35..7b49385 100644 --- a/docs/reference/anthro4.html +++ b/docs/reference/anthro4.html @@ -113,6 +113,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • diff --git a/docs/reference/figures/cohort.png b/docs/reference/figures/cohort.png new file mode 100644 index 0000000..adec215 Binary files /dev/null and b/docs/reference/figures/cohort.png differ diff --git a/docs/reference/figures/cohortResults.png b/docs/reference/figures/cohortResults.png new file mode 100644 index 0000000..af47a58 Binary files /dev/null and b/docs/reference/figures/cohortResults.png differ diff --git a/docs/reference/figures/cohortSidebar.png b/docs/reference/figures/cohortSidebar.png new file mode 100644 index 0000000..d232928 Binary files /dev/null and b/docs/reference/figures/cohortSidebar.png differ diff --git a/docs/reference/figures/sidebarCohortOptions.png b/docs/reference/figures/sidebarCohortOptions.png new file mode 100644 index 0000000..de494e9 Binary files /dev/null and b/docs/reference/figures/sidebarCohortOptions.png differ diff --git a/docs/reference/figures/sidebarSingleInput.png b/docs/reference/figures/sidebarSingleInput.png new file mode 100644 index 0000000..94c3dab Binary files /dev/null and b/docs/reference/figures/sidebarSingleInput.png differ diff --git a/docs/reference/figures/single.png b/docs/reference/figures/single.png new file mode 100644 index 0000000..e7e9b28 Binary files /dev/null and b/docs/reference/figures/single.png differ diff --git a/docs/reference/figures/singleResults.png b/docs/reference/figures/singleResults.png new file mode 100644 index 0000000..8395c67 Binary files /dev/null and b/docs/reference/figures/singleResults.png differ diff --git a/docs/reference/figures/singleSidebar.png b/docs/reference/figures/singleSidebar.png new file mode 100644 index 0000000..30957bd Binary files /dev/null and b/docs/reference/figures/singleSidebar.png differ diff --git a/docs/reference/getAllWGS.html b/docs/reference/getAllWGS.html index 76f5037..8775132 100644 --- a/docs/reference/getAllWGS.html +++ b/docs/reference/getAllWGS.html @@ -113,6 +113,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • diff --git a/docs/reference/getCohortWGS.html b/docs/reference/getCohortWGS.html index 3b63531..194b828 100644 --- a/docs/reference/getCohortWGS.html +++ b/docs/reference/getCohortWGS.html @@ -113,6 +113,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • diff --git a/docs/reference/getWGS.html b/docs/reference/getWGS.html index 2210ee6..2059a86 100644 --- a/docs/reference/getWGS.html +++ b/docs/reference/getWGS.html @@ -113,6 +113,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • diff --git a/docs/reference/getWGSR.html b/docs/reference/getWGSR.html index b7f34d8..19f67a0 100644 --- a/docs/reference/getWGSR.html +++ b/docs/reference/getWGSR.html @@ -114,6 +114,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • diff --git a/docs/reference/index.html b/docs/reference/index.html index 3993a65..28d75e8 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -108,6 +108,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • diff --git a/docs/reference/run_zscorer.html b/docs/reference/run_zscorer.html index a6f837e..315628e 100644 --- a/docs/reference/run_zscorer.html +++ b/docs/reference/run_zscorer.html @@ -110,6 +110,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • diff --git a/docs/reference/wgsData.html b/docs/reference/wgsData.html index f60ab65..9a3998f 100644 --- a/docs/reference/wgsData.html +++ b/docs/reference/wgsData.html @@ -110,6 +110,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • diff --git a/docs/reference/zscorer.html b/docs/reference/zscorer.html index 3bfb9b1..41ca046 100644 --- a/docs/reference/zscorer.html +++ b/docs/reference/zscorer.html @@ -116,6 +116,9 @@
  • Legacy functions
  • +
  • + Using zscorer Shiny application +
  • diff --git a/docs/sitemap.xml b/docs/sitemap.xml index fbd1720..89d2d99 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -48,4 +48,7 @@ https://nutriverse.io/zscorer/articles/legacy_functions.html + + https://nutriverse.io/zscorer/articles/using-shiny-app.html + diff --git a/inst/zscorer/server.R b/inst/zscorer/server.R index 3a7424d..ce1d5c1 100644 --- a/inst/zscorer/server.R +++ b/inst/zscorer/server.R @@ -136,12 +136,14 @@ function(input, output, session) { }) ## Input for index type output$index1 <- renderUI({ - selectInput(inputId = "index1", - label = "Select anthropometric index", - choices = index.list(), - multiple = TRUE, - size = 8, - selectize = FALSE) + if(input$dataType == 2) { + selectInput(inputId = "index1", + label = "Select anthropometric index", + choices = index.list(), + multiple = TRUE, + size = 8, + selectize = FALSE) + } }) ## output$header2 <- renderText({ @@ -167,7 +169,7 @@ function(input, output, session) { ## Select UI selectInput(inputId = "sex2", label = "Select sex variable", - choices = names(anthroDF()), + choices = c(" ", names(anthroDF())), selected = names(anthroDF())[names(anthroDF()) %in% c("sex", "SEX", "Sex", "Gender", "gender", "GENDER")]) } }) @@ -178,7 +180,7 @@ function(input, output, session) { ## Select UI selectInput(inputId = "weight2", label = "Select weight variable", - choices = names(anthroDF()), + choices = c(" ", names(anthroDF())), selected = names(anthroDF())[names(anthroDF()) %in% c("wt", "WT", "Wt", "weight", "Weight", "WEIGHT")]) } }) @@ -189,7 +191,7 @@ function(input, output, session) { ## Select UI selectInput(inputId = "height2", label = "Select height variable", - choices = names(anthroDF()), + choices = c(" ", names(anthroDF())), selected = names(anthroDF())[names(anthroDF()) %in% c("ht", "HT", "Ht", "height", "Height", "HEIGHT")]) } }) @@ -200,7 +202,7 @@ function(input, output, session) { ## Select UI selectInput(inputId = "age2", label = "Select age variable", - choices = names(anthroDF()), + choices = c(" ", names(anthroDF())), selected = names(anthroDF())[names(anthroDF()) %in% c("age", "AGE")]) } }) @@ -211,7 +213,7 @@ function(input, output, session) { ## Select UI selectInput(inputId = "hc2", label = "Select head circumference variable", - choices = names(anthroDF()), + choices = c(" ", names(anthroDF())), selected = names(anthroDF())[names(anthroDF()) %in% c("hc", "headCircumference", "hcircumference", "headCirc", "hcirc")]) } }) @@ -222,7 +224,7 @@ function(input, output, session) { ## Select UI selectInput(inputId = "muac2", label = "Select MUAC variable", - choices = names(anthroDF()), + choices = c(" ", names(anthroDF())), selected = names(anthroDF())[names(anthroDF()) %in% c("muac", "MUAC")]) } }) @@ -233,8 +235,9 @@ function(input, output, session) { ## Select UI selectInput(inputId = "ss2", label = "Select subscapular skinfold variable", - choices = names(anthroDF()), - selected = names(anthroDF())[names(anthroDF()) %in% c("subscapularSkinfold", "ss")]) + choices = c(" ", names(anthroDF())), + selected = names(anthroDF())[names(anthroDF()) %in% c("subscapularSkinfold", "ss")] + ) } }) ## Input for triceps skinfold variable @@ -244,7 +247,7 @@ function(input, output, session) { ## Select UI selectInput(inputId = "ts2", label = "Select triceps skinfold variable", - choices = names(anthroDF()), + choices = c(" ", names(anthroDF())), selected = names(anthroDF())[names(anthroDF()) %in% c("tricepsSkinfold", "ts")]) } }) @@ -362,15 +365,17 @@ function(input, output, session) { ssaz <- getWGSR(sex = input$sex1, firstPart = input$ts1, secondPart = age, index = "tsa") - output$ssaz <- renderText({ tsaz }) + output$tsaz <- renderText({ tsaz }) } }) ## observeEvent(input$calculate2, { ## zScoreDF <- anthroDF() + ## convert age into days + zScoreDF[[input$age2]] <- zScoreDF[[input$age2]] * (365.25 / 12) ## for cohort calculations - if(input$dataType == 2) { + ##if(input$dataType == 2) { ## BMI-for-age if("bfa" %in% input$index1) { zScoreDF <- addWGSR(data = zScoreDF, @@ -405,8 +410,8 @@ function(input, output, session) { sex = input$sex2, firstPart = input$hc2, secondPart = input$age2, - index = "hfa", - output = "hfa") + index = "hca", + output = "hca") } ## if("acfa" %in% input$index1) { @@ -423,8 +428,8 @@ function(input, output, session) { sex = input$sex2, firstPart = input$ss2, secondPart = input$age2, - index = "ssfa", - output = "ssfa") + index = "ssa", + output = "ssa") } ## if("tsfa" %in% input$index1) { @@ -432,8 +437,8 @@ function(input, output, session) { sex = input$sex2, firstPart = input$ts2, secondPart = input$age2, - index = "tsfa", - output = "tsfa") + index = "tsa", + output = "tsa") } ## if("wfh" %in% input$index1) { @@ -447,7 +452,7 @@ function(input, output, session) { ## output$zScoreTable <- DT::renderDataTable(zScoreDF, options = list(pageLength = 15)) - } + #} ## output$downloadResults <- downloadHandler( filename <- function() { diff --git a/inst/zscorer/ui.R b/inst/zscorer/ui.R index 05567a8..05d8c24 100644 --- a/inst/zscorer/ui.R +++ b/inst/zscorer/ui.R @@ -13,106 +13,114 @@ navbarPage(title = "zscorer", id = "chosenTab", theme = shinytheme("sandstone"), div(class = "outer", tags$head(includeCSS("styles.css")) ), - sidebarPanel(width = 3, - h5(textOutput("header1")), - ## Age input - uiOutput(outputId = "age1"), - ## sex input - uiOutput(outputId = "sex1"), - ## Weight input - uiOutput(outputId = "weight1"), - ## Height input - uiOutput(outputId = "height1"), - ## MUAC input - uiOutput(outputId = "muac1"), - ## Head circumference input - uiOutput(outputId = "hc1"), - ## Subscapular skinfold input - uiOutput(outputId = "ss1"), - ## Triceps skinfold - uiOutput(outputId = "ts1"), - ## Anthropometric index input - conditionalPanel("input.dataType == 2", - uiOutput(outputId = "index1") + sidebarLayout( + sidebarPanel(width = 3, + h5(textOutput("header1")), + ## Age input + uiOutput(outputId = "age1"), + ## sex input + uiOutput(outputId = "sex1"), + ## Weight input + uiOutput(outputId = "weight1"), + ## Height input + uiOutput(outputId = "height1"), + ## MUAC input + uiOutput(outputId = "muac1"), + ## Head circumference input + uiOutput(outputId = "hc1"), + ## Subscapular skinfold input + uiOutput(outputId = "ss1"), + ## Triceps skinfold + uiOutput(outputId = "ts1"), + ## Header 2 - input file with anthropometric data (dataType == 2) + h5(textOutput("header2")), + ## File input - anthro data + uiOutput(outputId = "file1"), + ## Anthropometric index input + uiOutput(outputId = "index1"), + ## Sex variable for cohort/sample + uiOutput(outputId = "sex2"), + ## Age variable for cohort/sample + uiOutput(outputId = "age2"), + ## Weight variable for cohort/sample + uiOutput(outputId = "weight2"), + ## Height variable for cohort/sample + uiOutput(outputId = "height2"), + ## mauc variable for cohort/sample + uiOutput(outputId = "muac2"), + ## head circumference variable for cohort/sample + uiOutput(outputId = "hc2"), + ## subscapular skinfold variable for cohort/sample + uiOutput(outputId = "ss2"), + ## Age variable for cohort/sample + uiOutput(outputId = "ts2"), + ## Action button to calculate single child z-scores + uiOutput(outputId = "calculate1"), + ## Action button to calculate cohort/sample z-scores + uiOutput(outputId = "calculate2"), + ## Action button to download cohort/sample z-scores + uiOutput(outputId = "download") ), - ## Header 2 - input file with anthropometric data (dataType == 2) - h5(textOutput("header2")), - ## File input - anthro data - uiOutput(outputId = "file1"), - ## Sex variable for cohort/sample - uiOutput(outputId = "sex2"), - ## Weight variable for cohort/sample - uiOutput(outputId = "weight2"), - ## Height variable for cohort/sample - uiOutput(outputId = "height2"), - ## Age variable for cohort/sample - uiOutput(outputId = "age2"), - ## Action button to calculate single child z-scores - uiOutput(outputId = "calculate1"), - ## Action button to calculate cohort/sample z-scores - uiOutput(outputId = "calculate2"), - ## Action button to download cohort/sample z-scores - uiOutput(outputId = "download") - ), - ## Main panel - mainPanel(width = 9, - tabsetPanel(id = "dataType", selected = 1, - tabPanel(title = "Single", value = 1, - conditionalPanel("input.calculate1", - column(width = 3, - wellPanel(h5("Weight-for-age z-score"), - hr(), - uiOutput(outputId = "waz") - ) - ), - column(width = 3, - wellPanel(h5("Height-for-age z-score"), - hr(), - uiOutput(outputId = "haz") - ) - ), - column(width = 3, - wellPanel(h5("Weight-for-height z-score"), - hr(), - uiOutput(outputId = "whz") + ## Main panel + mainPanel(width = 9, + tabsetPanel(id = "dataType", selected = 1, + tabPanel(title = "Single", value = 1, + conditionalPanel("input.calculate1", + column(width = 3, + wellPanel(h5("Weight-for-age z-score"), + hr(), + uiOutput(outputId = "waz") + ) + ), + column(width = 3, + wellPanel(h5("Height-for-age z-score"), + hr(), + uiOutput(outputId = "haz") + ) + ), + column(width = 3, + wellPanel(h5("Weight-for-height z-score"), + hr(), + uiOutput(outputId = "whz") + ) + ), + column(width = 3, + wellPanel(h5("BMI-for-age z-score"), + hr(), + uiOutput(outputId = "bfaz") + ) + ), + column(width = 3, + wellPanel(h5("MUAC-for-age z-score"), + hr(), + uiOutput(outputId = "mfaz") + ) + ), + column(width = 3, + wellPanel(h5("Head circumference-for-age z-score"), + hr(), + uiOutput(outputId = "hcz") + ) + ), + column(width = 3, + wellPanel(h5("Subscapular skinfold-for-age z-score"), + hr(), + uiOutput(outputId = "ssaz") + ) + ), + column(width = 3, + wellPanel(h5("Triceps skinfold-for-age z-score"), + hr(), + uiOutput(outputId = "tsaz") ) - ), - column(width = 3, - wellPanel(h5("BMI-for-age z-score"), - hr(), - uiOutput(outputId = "bfaz") - ) - ), - column(width = 3, - wellPanel(h5("MUAC-for-age z-score"), - hr(), - uiOutput(outputId = "mfaz") - ) - ), - column(width = 3, - wellPanel(h5("Head circumference-for-age z-score"), - hr(), - uiOutput(outputId = "hcz") - ) - ), - column(width = 3, - wellPanel(h5("Subscapular skinfold-for-age z-score"), - hr(), - uiOutput(outputId = "ssaz") - ) - ), - column(width = 3, - wellPanel(h5("Triceps skinfold-for-age z-score"), - hr(), - uiOutput(outputId = "tsaz") ) ) - ) - ), - tabPanel(title = "Cohort", value = 2, - conditionalPanel("input.calculate2", - ## z-scores table - DT::dataTableOutput("zScoreTable") + ), + tabPanel(title = "Cohort", value = 2, + conditionalPanel("input.calculate2", + ## z-scores table + DT::dataTableOutput("zScoreTable") + ) ) ) ) diff --git a/man/figures/cohort.png b/man/figures/cohort.png new file mode 100644 index 0000000..adec215 Binary files /dev/null and b/man/figures/cohort.png differ diff --git a/man/figures/cohortResults.png b/man/figures/cohortResults.png new file mode 100644 index 0000000..af47a58 Binary files /dev/null and b/man/figures/cohortResults.png differ diff --git a/man/figures/cohortSidebar.png b/man/figures/cohortSidebar.png new file mode 100644 index 0000000..d232928 Binary files /dev/null and b/man/figures/cohortSidebar.png differ diff --git a/man/figures/sidebarCohortOptions.png b/man/figures/sidebarCohortOptions.png new file mode 100644 index 0000000..de494e9 Binary files /dev/null and b/man/figures/sidebarCohortOptions.png differ diff --git a/man/figures/sidebarSingleInput.png b/man/figures/sidebarSingleInput.png new file mode 100644 index 0000000..94c3dab Binary files /dev/null and b/man/figures/sidebarSingleInput.png differ diff --git a/man/figures/single.png b/man/figures/single.png new file mode 100644 index 0000000..e7e9b28 Binary files /dev/null and b/man/figures/single.png differ diff --git a/man/figures/singleResults.png b/man/figures/singleResults.png new file mode 100644 index 0000000..8395c67 Binary files /dev/null and b/man/figures/singleResults.png differ diff --git a/man/figures/singleSidebar.png b/man/figures/singleSidebar.png new file mode 100644 index 0000000..30957bd Binary files /dev/null and b/man/figures/singleSidebar.png differ diff --git a/vignettes/.gitignore b/vignettes/.gitignore new file mode 100644 index 0000000..097b241 --- /dev/null +++ b/vignettes/.gitignore @@ -0,0 +1,2 @@ +*.html +*.R diff --git a/vignettes/using-shiny-app.Rmd b/vignettes/using-shiny-app.Rmd new file mode 100644 index 0000000..6706409 --- /dev/null +++ b/vignettes/using-shiny-app.Rmd @@ -0,0 +1,100 @@ +--- +title: "Using zscorer Shiny application" +author: "Ernest Guevarra" +date: "`r Sys.Date()`" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Using zscorer Shiny application} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) + +library(zscorer) +``` + +`zscorer` comes packaged with a built-in Shiny application. The application is initiated by issuing the following command: + +```{r runApp, echo = FALSE, eval = FALSE} +run_zscorer() +``` + +This opens the installed web browser in the user's device showing the following: + +```{r zscorerFrontpage, echo = FALSE, eval = TRUE, out.width = "90%"} +knitr::include_graphics("../man/figures/zscorerApp.png") +``` + +# Getting the z-score of a single child + +The first (and default) functionality of the built-in Shiny application is for calculating the z-scores for a single child. This functionality is accessed by selecting the `single` option on the tabbed menu available in the top edge of the application interface as shown below: + +```{r single, echo = FALSE, eval = TRUE, out.width = "30%"} +knitr::include_graphics("../man/figures/single.png") +``` + +When this functionality is selected, the sidebar menu provides the following options: + +```{r singleMenu, echo = FALSE, eval = TRUE, out.width = "30%"} +knitr::include_graphics("../man/figures/singleSidebar.png") +``` + +In this sidebar menu, the user should enter all the anthropometric measurements available for the child to whom user wants to calculate z-scores of. For the calculation to work, the minimum data needed to be supplied by the user are: + +* **Age**; + +* **Sex**; and, + +* At least one anthropometric measurement among **weight (kgs)**, **height (cms)**, **mid-upper arm circumference (cms)**, **head circumference (cms)**, **subscapular skinfold (cms)** or **triceps skinfold (cms)**. + +Please ensure that any anthropometric measurement is supplied in the appropriate units as indicated above. + +To illustrate, let's use the dummy data of a **52 month** old **male** child with a weight of **14.6 kg** and a height of +**98.0 cm**. This data is typed into the sidebar menu and then click on the `Calculate` tab as shown below: + +```{r sidebarSingleInput, echo = FALSE, eval = TRUE, out.width = "30%"} +knitr::include_graphics("../man/figures/sidebarSingleInput.png") +``` + +This produces the following output in the main panel of the application: + +```{r singleResults, echo = FALSE, eval = TRUE, out.width = "90%"} +knitr::include_graphics("../man/figures/singleResults.png") +``` + +Depending on the anthropometric measurements supplied, the corresponding applicable z-score indices will be provided. No z-score result will be provided if the required anthropometric measurement is not supplied. In the example above, MUAC-for-age, head circumference-for-age, subscapular skinfold-for-age and triceps skinfold-for-age are not provide as no MUAC, head circumference, subscapular skinfold or triceps skinfold are provided. + +# Getting the z-score of a cohort of children + +The second functionality of the built-in Shiny application is for calculating the z-scores for a cohort of children. This functionality is accessed by selecting the `cohort` option on the tabbed menu available in the top edge of the application interface as shown below: + +```{r cohort, echo = FALSE, eval = TRUE, out.width = "30%"} +knitr::include_graphics("../man/figures/cohort.png") +``` + +When this functionality is selected, the sidebar menu provides the following options: + +```{r cohortMenu, echo = FALSE, eval = TRUE, out.width = "30%"} +knitr::include_graphics("../man/figures/cohortSidebar.png") +``` + +In this sidebar menu, the user is expected to upload cohort data of children with their anthropometric data. The user is also expected to select which anthropometric indices to calculate. If no anthropometric indices are selected, no calculations will be performed. A cohort data can be uploaded by clicking on the `Browse` button and then selecting the file with cohort data to upload. Once uploaded, the sidebar menu will provide the following additional options: + +```{r cohortOptions, echo = FALSE, eval = TRUE, out.width = "30%"} +knitr::include_graphics("../man/figures/sidebarCohortOptions.png") +``` + +For the `zscorer` app to be able to calculate z-scores from the cohort data, the variables corresponding to the required information needs to be supplied. By default, the application will search the variable names in the data and pick out typical variable names for the measurements (e.g., `ht` or `height` or `HT` or `Height` or `HEIGHT` for height measurements). If the variables are named unconventionally, user will have to select the variable name for the particular measurement from the choices. If the measurements are not in the data, then the variable field should be left empty. + +Once the various parameters have been provided, user should click on the `Calculate` button which results in the following: + +```{r cohortResults, echo = FALSE, eval = TRUE, out.width = "90%"} +knitr::include_graphics("../man/figures/cohortResults.png") +``` + +The dataset provides is presented as a table in the main panel but now with additional fields for the calculated anthropometric indices. The resulting dataset with the calculated anthropometric indices can then be downloaded by clicking on the `Download` button.