Remove rows with all or some NAs (missing values) in data.frame

后端 未结 16 1601
日久生厌
日久生厌 2020-11-21 05:49

I\'d like to remove the lines in this data frame that:

a) contain NAs across all columns. Below is my example data frame.



        
16条回答
  •  野性不改
    2020-11-21 06:24

    This will return the rows that have at least ONE non-NA value.

    final[rowSums(is.na(final))

    This will return the rows that have at least TWO non-NA value.

    final[rowSums(is.na(final))<(length(final)-1),]
    

提交回复
热议问题