BMI Calculator in Shiny

Alexander Seifert

About the app

The BMI Calculator is just a simple example of a Shiny app devised for the Developing Data Products course on Coursera. The source is hosted on GitHub, so feel free to fork it. The app itself is hosted on shinyapps.io.

The BMI calculation is really trivial, the only thing to note is that you have to multiply the index by 703 if you are dealing with imperial units. For example person weighing 80kg at a size of 1.90m (with metric units now) would have a BMI of:

height = 1.9
weight = 80
weight/height^2  # BMI (for imperial units multiply by 703)
## [1] 22.16

which represents a normal healthy weight.

The Body Mass Index

What's a BMI?

"The body mass index (BMI), or Quetelet index, is a measure of relative weight based on an individual's mass and height.

Devised between 1830 and 1850 by the Belgian polymath Adolphe Quetelet during the course of developing 'social physics', it is defined as the individual's body mass divided by the square of their height – with the value universally being given in units of \(kg/m2\)." [1]

What does the BMI tell me?

"The BMI is used in a wide variety of contexts as a simple method to assess how much an individual's body weight departs from what is normal or desirable for a person of his or her height." [1]

[1] Body mass index on Wikipedia

How to use the app

  1. Visit the app on shinyapps.io
  2. Choose your preferred system of units, either metric (kilograms & centimetres) or imperial (pounds and inches).
  3. Provide your weight
  4. Provide your height
  5. You will see the numbers on the right side update as you input your data. The chart gives you a good idea of how your BMI is to be interpreted.

What the app looks like (Screenshot)

Screenshot of the app in action