BMI presentation

Gary Clarke
15/12/2020

User instructions

-The user enters a numeric weight in kilos -The user enters their height in metres by using a slider -The BMI calculation is returned in the main page

BMI application

  • The application provides a simple entry screen
  • It features two input types; a slider and a numeric input
  • There are three font sizes utilised
  • A simple function is used in the server code to calculate the input and deliver the output -The formula used is 1.3 x weight / height2

UI code

library(shiny)
shinyUI(fluidPage(
    titlePanel("Body Mass Indicator"),
    sidebarLayout(
        sidebarPanel(
            h2("Enter your weight and height"),

            h1(numericInput("numeric", "Enter weight in kilos", 
                         value = 75, min = 30, max = 150, step = 1)),
            h1("Enter height in metres"),
            sliderInput("slider1", "Slide Me!", 1.3, 2.5, 0)
        ),
        mainPanel(
            h1("BMI score"),
            h1(textOutput("pred2"),

            h2("A BMI score between 18 and 24.9 is considered healthy"),



            h5("*App developed for Coursera Project not for healthcare use"))
        )
    )
))

<!–html_preserve–>

Body Mass Indicator

Enter your weight and height

Enter height in metres

BMI score

A BMI score between 18 and 24.9 is considered healthy

*App developed for Coursera Project not for healthcare use

<!–/html_preserve–>

Server code

library(shiny)
shinyServer(function(input, output) {
    output$pred2<- renderText({


        calc_sum <- reactive({
            (input$numeric*1.3) / (input$slider1^2.5)
        })

        #....

      output$pred2 <- renderText({
            calc_sum()
        })  


        })
    })