BMI For Age
04 Nov 2015I build the R package bmiage to ease the classification of BMI for age and sex. It uses CDC child bmi charts to assign each bmi to the four categories: underweight, healthy weight, overweight and obese.
To install the package:, run these two lines of R codes.
devtools::install_github("epinotes/bmiage")
library(bmiage)
Examples
Looking into the help files for the function bmicat
?bmicat
When no dataset is provided try:
bmicat(data = NULL,sex = "F",age = 18,wt.kg = 70 ,ht.m = 1.75, age.unit="year",bind = F)
## bmi bmicat
## 1 22.85714 1
Now let's create a dataframe df:
df <- data.frame(sex = c("F","M", "F"), age = c(18,15,NA), weight = c(70,50, 55), height = c(1.75, 1.60, 1.65))
We can use the new dataframe, df, with the function bmicat:
df <- bmicat(data = df,sex = sex,age = age,wt.kg = weight ,ht.m = height, age.unit="year",bind = T)
df
## sex age weight height bmi bmicat
## 1 F 18 70 1.75 22.85714 1
## 2 M 15 50 1.60 19.53125 1
## 3 F NA 55 1.65 20.20202 NA
Now df has two added variables.