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?
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)
.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments