BMI-calculation app

Gerard van Meurs
April 10, 2019

Introduction

To test the BMI-app, please go to: https://gerardvanmeurs.shinyapps.io/BMI-Calculator.

With this Shiny-app you can calculate your Body Mass Index (BMI) based on:

  • your weight in kg
  • your height in cm

The app:

  • will display your BMI-value
  • will display the WHO-suggested classification
  • contains a documentation tab

Design

  • a separate ui.R and a server.R
  • pageWithSidebar instead of a FluidPage design
  • layout in ui.R
  • computation in server.R
  • non-reactive computation by means of SubmitButton

server.R

Inside the server.R part:

bmi <- function(weight,height) {round(weight/((height/100)^2),1)}
bmiCat <- function(bmi){
  ifelse(bmi < 18.5,"underweight",ifelse(bmi < 25,"normal weight",ifelse(bmi < 30,"overweight","obese")))
}
weight <- 75
height <- 175
(bmi_num <- bmi(weight, height)); bmiCat(bmi_num)
[1] 24.5
[1] "normal weight"

QandA

  • any questions?
  • Thank you for your time and attention!!