- BMI is body mass index.
- It used height and body weight.
- It measures the body health status.
2023-08-14
library(shiny)
## Warning: package 'shiny' was built under R version 4.2.3
ui <- fluidPage(
titlePanel("All About Health! All About Your BMI!"),
sidebarLayout(
sidebarPanel(
numericInput("n1", "My Weight in Kgs", 0),
numericInput("n2", "My Height in meters", 0),
actionButton("BMI", "What is my BMI?")
),
mainPanel(textOutput(outputId = "n1_divide_n2"))
)
)
library(shiny)
server <- function(input, output){
observeEvent(input$BMI, {
bmi <- input$n1 + input$n2
add_text <- sprintf("Your BMI is %d / %d = %d", input$n1, input$n2, bmi)
output$n1_divide_n2 <- renderText(add_text)
})
}