I have a date frame with 89000
lines and in one of the columns the relationship with the employee appears. I need to split in 4 classes
, namely:
- Class 1 - Conjugue / Children
- Class 2 - Mother / Father
- Class 3 - Brothers
- OTHER - Other Relatives
I need to create a column in the data frame that inserts the employee's kin class (I need to keep the original parentage in the base). I did with a set of% nested%, but I would like to know if there is a more "elegant" solution.
ifelse(base.dados$Parentesco %in% classe1, base.dados$CLASSE <- "CLASSE 1",
ifelse(base.dados$Parentesco %in% classe2, base.dados$CLASSE <- "CLASSE 2",
ifelse(base.dados$Parentesco %in% classe3, base.dados$CLASSE <- "CLASSE 3", "OUTRAS")))