I am now learning R, and I have problem with finding a command.
I have the categorical data
levels(job)
[1] "admin." "blue-collar" "entrepreneur" "housemaid"
[5] "management" "retired" "self-employed" "services"
[9] "student" "technician" "unemployed" "unknown"
now I want to simplify these levels, such as
levels(job)
[1] "class1" "class2" "class3" "unknown"
where type1
includes "admin."
, "entrepreneur"
, and "self-employed"
;
type2
includes "blue-collar"
,"management"
, and "technician"
;
type3
includes "housemaid"
, "student"
, "retired"
, and "services"
;
unknown
includes "unknown"
and "unemployed"
.
For this purpose, which command can I use? Thanks! Yan