R Shiny Apps from CPEG-GCEP

A list of common problems with input data formats can be found at the bottom of this page.

R is a comprehensive, open-source statistical programming environment available from the Comprehensive R Archive Network (CRAN) for Mac, Windows, and Linux. According to a recent editorial in the Journal of Statistical Software,

Attesting to the importance of R in studies of pediatric growth, the World Health Organization (WHO) used R GAMLSS to fit their standard (0-5y, 2006) and reference (5-19y, 2007) growth charts using the Lambda-Mu-Sigma (LMS) model; they currently offer R macros for calculating a variety of anthropometric Z scores based on these charts i.e. igrowup 0-5y and who2007 5-19y

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents with embedded R code and analyses. It can be further extended to support interactive R analyses hosted on a Shiny server.

The Canadian Pediatric Endocrine Group CPEG-GCEP is the official Canadian association for pediatric endocrinology. Our membership is comprised of pediatric endocrinologists, pediatric endocrine nurses, and pediatric subspecialty residents who are training to become endocrinologists. We are a highly collaborative and collegial group dedicated to caring for children and adolescents with endocrine disorders. To better support our membership, we have developed a comprehensive suite of Shiny tools for monitoring growth in both a clinical and research context, with both Z-score calculators (Zapps™) and growth chart plotters. For best performance, we recommend an HTML5-compliant browser e.g. Chrome, Safari, or Firefox. For the most part, our computational algorithms and LMS tables were provided by the original developers with one exception: Since the WHO did not provide weight-for-age beyond 10 years, these LMS tables are based on our published re-analysis of WHO/NCHS data.

Most apps are availabe as both batch calculators (data in spreadsheets) and direct data entry (DDE) formats, where measurements for individual patients are input through the browser (e.g. for mobile or clinic use):

Growth chart plotters for direct data entry

If you prefer to use an HTML5 web application to plot growth charts in your own browser, you will find these elsewhere on our site.

We are also happy to share our R, SAS, or Stata macros to calculate Z-scores. An Excel calculator (Windows only) and an Android app are also available.

These tools are works in progress and are offered for use at your own risk; you should always exercise caution. We recommend that you confirm important results using published charts, particularly for assigning diagnoses, whose definitions are sometimes contradictory. The individual pages provide links for clinical diagnoses, for algorithmic details, and for the sometimes conflicting definitions of biologically implausible values (biv). Please feel free to contact us with questions or comments.

Common errors in spreadsheet inputs

The apps are fairly bullet proof, but here are things to watch out for if you’re having problems with your spreadsheet inputs

  1. The column names must be spelled as shown in the sample file. Case matters e.g. “Sex” is not the same as “sex”. The same is true for values assigned to strings e.g. “f” is not the same as " f“, and O is not the same as 0. Looking at your data in a simple text editor (e.g. NotePad in Windows or TextEdit in MacOS) may reveal format details that are concealed by Excel, such as leading or trailing spaces.

  2. If you’re using a European keyboard and system configuration, you may be using commas (“,”) in lieu of decimal points (“.”) e.g. 3.1415 in North America is 3,1415 on your system. This can create problems when you choose to “Save As .csv”." A .csv file is a plain text file whose columns are separated by commas (csv = comma separated variables). For reasons known only to Microsoft, a semicolon (“;”) separator may be used instead of a comma when you choose to Save As .csv on a European system. There are two fixes for this problem

    • Open your file in a simple text editor (NotePad, TextEdit) and carry out two sequential Search/Replace operations: First, replace all commas with periods (so 3,1415 becomes 3.1415). Then, replace all semicolons with commas (so the columns are appropriately separated).

    • Temporarily configure your system to use decimal points and commas (as an English keyboard). It takes a second and is reversible (I routinely have to do this when using my French-Canadian keyboard). See Mac or Windows instructions.

  3. Sex can be input at M, m, 1 (males) vs F, f, 2 (females). To our surprise, we’ve recently learned that if the column contains only F’s, R may read the entire column as logical values, since F is the built-in short-cut for FALSE. I will eventually eliminate this bug, but the simple work-around is to use f or 2 or simply ensure that there is at least one M in the column to force proper recognition.

  4. For all apps, the variable id is the user-specified row identifier. In addition to allowing you to identify your data rows for subsequent analysis, the identifier is used to stitch together the various calculated z-scores and percentiles before returning the output spreadsheet. For this reason, the identifier (id) must be unique for each row in your dataset or the calculator will abort.

  5. For assistance with .csv file creation, you may want to review our brief instruction guide.