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”. Note that “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 include non-numeric data in your input, the entire column will be read as text and the application may fail. Common errors include 'O' vs '0' or '..' instead of the decimal point ('.').This also applies to the missing data indicator, where the App will accept either a blank space (Excel default) or NA (R default). It will however report an error if you get creative, as it doesn't know how to interpret '.' or '#NULL!' as missing data markers. As noted above, leading or trailing space can also be a problem: ' NA' is not the same as 'NA'. So if you're having problems, it may be helpful to examine your input file in a simple text editor (e.g. NotePad in Windows or TextEdit in MacOS).

  3. In some European system configurations, Microsoft uses a semi-colon (";") as their default "list separator". To check, just open your .csv file in a simple text editor (e.g. NotePad for Windows or TextEdit for Mac). If you see semi-colons, you have found your problem. As a result, when you choose "Save As .csv", the columns are separated by semi-colons rather than commas, which is non-sensical, since a .csv file is - by definition - a plain text file with columns separated by commas (csv = comma separated variables). Fortunately, there are two quick fixes:

    • Open your file in a simple text editor (NotePad, TextEdit) and carry out a Search/Replace operations to replace all semicolons with commas (so the columns are appropriately separated).

    • Re-configure the default list separator to be a comma instead of a semi-colon. Under Windows, go to the Windows Region and Language control panel and find the List Separator setting. It only takes a second and is reversible. For details, see Mac or Windows instructions.

  4. 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.

  5. 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. If for some reason you want to include empty rows in your data, they still require unique identifiers.

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