r检查整列的值是否大于STH
我有一个年龄的专栏,我需要指定年龄以上还是低于某个水平。我还有2列具有因子值t或f(value.if.age.under.13和value.if.age.over.13)。我的代码始终运行其他语句。
for (i in nrow(dclas)){
if (dclas[i,6]<13.0){
x = value.if.age.under.13
} else{
x = value.if.age.over.13
}
}
I have a column where is age and I need to specify whether the age is above or below some level. I also have 2 columns with factor values T or F (value.if.age.under.13 and value.if.age.over.13). My code is always running the else statement.
for (i in nrow(dclas)){
if (dclas[i,6]<13.0){
x = value.if.age.under.13
} else{
x = value.if.age.over.13
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
已经用辅助变量解决了。
如果年龄超过13岁,并且最后连接在一起。
Already solved with auxiliary variable.
The same if age is over 13. And at the end connect both.