lundi 13 janvier 2020

Multiple If condition for single column

I have to categorize the age variable by three groups in a single column of a data frame.

Group1 as 1 = >=25-44 age
Group2 as 2 = >=44-60 age
Group3 as 3 = >=60 age
Group4 as 4 = NA

How could I use the If condition to group the values (i.e: Age_cat = 1, Age_cat=2, Age_cat=3, Age_cat =0) in single column on the data frame.

Aucun commentaire:

Enregistrer un commentaire