bmi calculates the BMI in kilograms per meter squared.

bmi(mass, height)

Arguments

mass, height

A numerical vector with body mass and height data. mass unit must be kilograms and height unit must be meters. If the height unit is centimeters, it is converted to meters before BMI computation and a warning is shown.

Value

Returns a double vector with the element-wise body mass index (BMI).

See also

Examples

mass <- sample(50:100, 20) height <- rnorm(20, mean = 1.7, sd = 0.2) bmi(mass, height)
#> [1] 31.16581 49.92384 38.63921 15.72342 33.71293 22.56426 32.76956 19.26847 #> [9] 32.27864 28.79811 18.87992 20.87949 22.56731 13.50273 24.91068 15.17675 #> [17] 16.94631 16.63508 14.03750 29.01913