Body-Mass Index(BMI) Web Application

Mahmoud Shaaban
28 May 2016

Body-Mass Index

The body mass index (BMI) or Quetelet index is a value derived from
the mass (weight) and height of an individual. The BMI is defined as
the body mass divided by the square of the body height,
and is universally expressed in units of kg/m2,
resulting from mass in kilograms and height in metres.

formula

(Wikipedia)

Interpretion of BMI values

Inpute, by the user:

  • Height in meters
  • Weight in kilograms
  • Press Submit

Then place the resulting value on the curve

interpretion table

User Interface

library(shiny)
shinyUI(
    pageWithSidebar(
        headerPanel("Body-Mass Index (BMI)"),
                sidebarPanel(
            numericInput('height', 'Your Height (m)', 1.7),
            numericInput('weight', 'Your Weight (kg)', 70),
            submitButton('Submit')
        ),
        mainPanel(
            h3('Your BMI'),
            verbatimTextOutput("prediction")
        )
    )
)

Server

library(shiny)
bmi <- function(h, w) w / (h^2)

shinyServer(
    function(input, output) {
        output$prediction <- renderPrint({bmi(input$height, input$weight)})
    }
)