lundi 5 juillet 2021

Create 4 categories variables

I used a survey that has 20 questions and I calculated the mean of the 20 questions as "Total" for 400 participants. Now I need to categorise the Total into 4 groups: Total < 2 is limited, Total >= 2 is basic, Total < 3 is Good, and Total >= 3 is Full

I was able to create three but not four variables as follow:

level <- ifelse (df$Total <2, "Limited", ifelse((df$Total>= 2) & (df$Total<3), "Basic","Good"))

Aucun commentaire:

Enregistrer un commentaire