I would like to create a new column that classifies a person's BMI into certain categories.
I am not sure where I am going wrong:
brfss2013 <- brfss2013 %>%
mutate(bmi_class = if (X_bmi5 < 18.5) {
X_bmi5 == 'underweight'}
else if (X_bmi5 in range(18.5,24.9)){
X_bmi5 =='normal'}
else if (X_bmi5 in range(25,29.9)) {
X_bmi5 =='overweight'}
else if (X_bmi5 in range(30,34.9)){
X_bmi5 =='class 1 obesity'}
else if (X_bmi5 in range(35,39.9)){
X_bmi5 =='class 2 obesity'
else if (X_bmi5 > 39.9){
X_bmi5 == 'class 3 obesity')}
else 'NA')
Aucun commentaire:
Enregistrer un commentaire