My dataset looks like this:
df <- data.frame(PatientID = c("3454","345","5","345","567","79"), sex = c(Female, Female, Female, Male, Male, Male)
waist = c(60, 89, 90, 110, 200, 150), tryglicerides = c(100, 150, 170, 105, 200, 140),HDL = c(50, 41, 20, 37, 30, 40), hypertension = c(FALSE, TRUE, TRUE, FALSE, TRUE, FALSE), diabetes = c(FALSE, FALSE, TRUE, TRUE, TRUE, FALSE), stringsAsFactors = F)
Could you help me coding this in R please?
Thanks!
I need to create a new column that will be called METABOLIC_SYNDROME
. For the participant to be TRUE
in the column METABOLIC_SYNDROME
needs to fulfil 3/5 of these conditions:
- Waist: ≥89 in Female, ≥102 in Male
- Trygliceride: ≥150
- HDL: ≤40 Male, ≤50 Female
- Hypertension: TRUE
- Diabetes: TRUE
question from:
https://stackoverflow.com/questions/65843453/create-a-new-column-based-on-conditional-inclusion-fulfilling-conditions-in-r 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…