data<-c(1,2,3,4,7,8,9)
result<-""
for(i in 1:length(data)){
if(data[i]<=5){
result[i]<-"非付费用户";
}else{
result[i]<-"付费用户";
}
}
data.frame(data = result[1:length(data)])
结果就是:
data<-c(1,2,3,4,7,8,9)
result<-""
for(i in 1:length(data)){
if(data[i]<=5){
result[i]<-"非付费用户";
}else{
result[i]<-"付费用户";
}
}
data.frame(data = result[1:length(data)])
结果就是: