z644070039 发表于 2017-9-3 16:05 
简单的修改了一下,
这个只是对向量进行了判断和填充数字啊,而我是要对数据框进行判断,根据判断情况进行赋值
报错:
Error in `$<-.data.frame`(`*tmp*`, "X2", value = c("001", NA, NA, "002", :
replacement has 20 rows, data has 9
In addition: Warning message:
In if (test$X1 == "是") print("不变") else test$X2
<- test$X2[i - :
the condition has length > 1 and only the first element will be used
其中test就是那个数据框,还求大神指教