Reputation: 10199
I have datafrom
df
1 a c NA NA
2 a a a NA
3 c NA NA NA
Firstly, I want to find which row has the highest number of NA value. I am also interested to find rows with the condition of having more than 2 NA values.
How can I do it in R?
Upvotes: 3
Views: 1128
Reputation: 146164
na_rows = rowSums(is.na(df))
gives the count of NA by row. You can then look at which.max(na_rows)
and which(na_rows > 2)
.
Upvotes: 7