calculate_bmi: Calculate Body Mass Index (BMI)

View source: R/calculate_bmi.R

calculate_bmiR Documentation

Calculate Body Mass Index (BMI)

Description

Uses weight (kg) and height (m) to calculate BMI. Converts from lbs and inches if needed and units are properly supplied.

Usage

calculate_bmi(height, weight, height_units = "m", weight_units = "kg")

Arguments

height

height in cm, m, or inches

weight

weight in lbs or kg

height_units

units in "cm", "m", or "inches"

weight_units

units as "lbs" or "kg"

Value

numeric vector containing BMI results

Examples

calculate_bmi(height = 1.778, weight = 75)

calculate_bmi(height = 70, weight = 165,
              height_units = "inches", weight_units = "lbs")
              
#incorrect units
calculate_bmi(height = 70, weight = 165,
              height_units = "in", weight_units = "lbs")
              
calculate_bmi(height = c(70, 72, 65), 
              weight = c(165, 180, 155),
              height_units = "inches", weight_units = "lbs")

JMLuther/tabletools documentation built on July 1, 2024, 2:01 p.m.