Body Mass Index (BMI) is a calculated measure of weight relative to height, defined as body weight in kilograms divided by height in meters squared (Keys et al., 1972). If return_graph is TRUE, an ggplot object is returned instead of a bmi value.

calculate_bmi(weight, height, return_graph = FALSE)

Arguments

weight

A numeric number of body weight value.

height

A numeric number of height value.

return_graph

TRUE or FALSE on whether to return a graphical visualization instead of a bmi value.

Value

A numeric number of body mass index value (rounded to two decimals).

Examples

calculate_bmi(100, 1.85, return_graph=FALSE)
#> [1] 29.22

29.22
#> [1] 29.22