Developing Data Products

NN
10th Feb 2018

BMI Calculator

  • Based on the BMI levels defined on Wikipedia
  • User inputs height and weight
  • BMI calculated by Weight in Kg / (Height in m)2

Calculating BMI

bmi = round(weight/(height/100)^2, 1)

Plotting BMI

Your BMI will be presented in a barplot as follows. The categories are per Wikipedia. Here, we present a BMI of 23:

dat<-matrix(c(15, 1, 2.5 ,6.5 , 5, 5, 5), ncol = 1, nrow = 7)
barplot(dat, horiz = TRUE, yaxt="n", xlab = "BMI", main="BMI Scale", col=c("darkred", "red", "orange", "green", "orange", "red", "darkred", "darkred")); lines(x=c(23, 23), y=c(0,1.2), col="blue", lwd=5)

plot of chunk unnamed-chunk-2

Thank You

  • If you would like to find out more about BMI, please refer to the Wiki page