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

R Programming

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

 

2
Answers

Replies

There are no replies to this topic.
 

If you want to unleash your potential in this competitive field, please visit the R Programming course page for more information, where you can find the R Programming tutorials and R Programming frequently asked interview questions and answers as well.

 

This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.