Re: [讨论] for loop与*apply function请益

楼主: JX660 (JX)   2015-05-22 21:13:23
我自己会用下面的写法
data$group<-
ifelse( data[,8] < 0.25 , 1 ,
ifelse( data[,8] < 0.50 & data[,8] > 0.25 , 2 ,
ifelse( data[,8] < 0.75 & data[,8] > 0.50 , 3 , 4 ) ) )
data$group<- factor( data$group ,
labels=c("group1","group2","group3","group4"))
或许可以参考看看
但我不确定在你的资料会不会比较快

Links booklink

Contact Us: admin [ a t ] ucptt.com