mydata$运营商<-if(grepl("移动",mydata$产品名称)){运营商<-"移动"}else {if(grepl("电信",mydata$产品名称)){运营商<-"电信"}else {运营商<-"联通"}}
结果是:所有变量值均为联通
Warning messages:
1: In if (grepl("移动", mydata$产品名称)) { :
the condition has length > 1 and only the first element will be used
2: In if (grepl("电信", mydata$产品名称)) { :
the condition has length > 1 and only the first element will be used
是哪里有问题 ?应该怎么修改?


雷达卡



京公网安备 11010802022788号







