标签: r sapply
v5<-sapply(v4, function(x) {if(x>0) levels[2] else levels[1]}) return(v5)
显示以下警告消息:
In if (x > 0) 1 else -1 : the condition has length > 1 and only the first element will be used
sapply将x作为向量v4的单个元素,但在尝试运行此代码时仍然会弹出错误。
sapply
x
v4