You can assign to :levels
levels(z)[levels(z)%in%c("unemployed","unknown","self-employed")] <- "unknown"
This is covered in the help file -- type .?levels
Stealing from @akrun's answer, you could do this most cleanly with a hash/list:
ha <- list(
unknown = c("unemployed","unknown","self-employed"),
class1 = c("admin.","management")
)
for (i in 1:length(ha)) levels(z)[levels(z)%in%ha[[i]]] <- names(ha)[i]