美文网首页
argument is not numeric or logic

argument is not numeric or logic

作者: kkkkkkang | 来源:发表于2020-09-27 10:50 被阅读0次

R aggregate函数warnings: In mean.default(X[[i]], ...) :argument is not numeric or logical: returning NA

#解决办法:FUN后面自己写函数把元素转换为numeric类型即可

aggregate(testing[-1], by = list(testing$V1), FUN = function(x) mean(as.numeric(as.character(x))))

相关文章

网友评论

      本文标题:argument is not numeric or logic

      本文链接:https://www.haomeiwen.com/subject/stytuktx.html