将连续数值转换为由间隔定义的离散类别
# Some example datarota2 <- data.frame(age_mnth = 1:170)
ifelse
rota2$age_gr<-ifelse(rota2$age_mnth < 6, rr2 <- "0-5 mnths", ifelse(rota2$age_mnth > 5 & rota2$age_mnth < 12, rr2 <- "6-11 mnths", ifelse(rota2$age_mnth > 11 & rota2$age_mnth < 24, rr2 <- "12-23 mnths", ifelse(rota2$age_mnth > 23 & rota2$age_mnth < 60, rr2 <- "24-59 mnths", ifelse(rota2$age_mnth > 59 & rota2$age_mnth < 167, rr2 <- "5-14 yrs", rr2 <- "adult")))))
cut
梦里花落0921
蛊毒传说