Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Data Science
  3. Question
Data Science

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

Asked by Anurag Singhal Jun 4, 2021 1.5K views 1 answer
Share

About this question

Want to remove the lines from data frame from that :

  • Have NAs across all columns 

             a                               b    c       d     e        f
1 YASH00000206234    0   NA   NA   NA   NA
2 YASH00000199774    0    2        2       2      2
3 YASH00000221722    0   NA   NA   NA   NA
4 YASH00000207704    0   NA   NA   1       2
5 YASH00000207531    0   NA   NA   NA   NA
6 YASH00000221412    0   1        2      3       2 

I would like to get the data frame as follows :

             a                             b    c    d    e    f
2 YASH00000199774    0   2    2    2    2
6 YASH00000221412    0   1    2    3    2 
  • Have NAs in only some columns and the result I will get:

             a                              b   c    d     e    f    
2 YASH00000199774    0   2    2    2    2
4 YASH00000207704   0  NA  NA 1   2 
6 YASH00000221412    0   1    2    3    2

Your answer

1 Answer

More Data Science discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Data Science Blogs

Guides, tips and career advice on Data Science from JanBask experts.