找到R

时间:2018-04-16 22:20:14

标签: r row missing-data

我有数据来自

df
1 a c  NA NA
2 a a  a  NA
3 c NA NA NA

首先,我想找到哪个行的NA值最多。我也有兴趣找到条件超过2个NA值的行 我怎么能在R?

1 个答案:

答案 0 :(得分:7)

na_rows = rowSums(is.na(df))按行计算NA数。然后,您可以查看which.max(na_rows)which(na_rows > 2)