Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201867

In R, How do I filter a data frame to only include rows with >=2 non-NA values?

$
0
0

Suppose I have a dataframe

      Grp1 Grp2 Grp3
Trt1    NA    1   NA
Trt2     2    3   NA
Trt3     4   NA    5

I'd like to filter this down to only include rows where the number of non-NA values is greater than some total (in this case 2). So for this example I would like a result:

      Grp1 Grp2 Grp3
Trt2     2    3   NA
Trt3     4   NA    5

Viewing all articles
Browse latest Browse all 201867

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>