s-news
[Top] [All Lists]

Re: remove all rows that have at least one NA

To: Yannis.C.Tzamouranis@dynegy.com
Subject: Re: remove all rows that have at least one NA
From: Sven.Knudsen@adeptscience.dk
Date: Wed, 12 Jun 2002 16:31:38 +0200
Cc: s-news@lists.biostat.wustl.edu
                                                                                
                                                                      
                      Yannis.C.Tzamouranis@dyne                                 
                                                                      
                      gy.com                           To:       
s-news@lists.biostat.wustl.edu                                                  
     
                      Sent by:                         cc:                      
                                                                      
                      s-news-owner@lists.biosta        Subject:  [S] remove all 
rows that have at least one NA                                        
                      t.wustl.edu                                               
                                                                      
                                                                                
                                                                      
                                                                                
                                                                      
                      12-06-2002 15:45                                          
                                                                      
                                                                                
                                                                      
                                                                                
                                                                      








>Hi folks.
>Just a basic question:
>Is there a quick way to remove all rows from a data frame which have at
>least one NA?

>Yannis

Just use the following:


>Mydf <- data.frame(x1=c(1,2,3,4,NA,6), x2=c(1,NA,NA,4,5,6),
   x3=c(1,2,3,4,5,6))

> na.exclude(Mydf)
  x1 x2 x3
1  1  1  1
4  4  4  4
6  6  6  6



Venlig hilsen / Best Regards
Adept Scientific

Sven J. Knudsen

*********************************************************************
Solutions for Technical Computing

Adept Scientific Aps             Tel: ; +45 48 25 17 77
Nordre Jernbanevej 13C       Fax: ; +45 48 24 08 47
DK-3400  Hillerød

Web:  http://www.adeptscientific.dk
WebStore:  http://www.adeptstore.dk
********************************************************************




--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu.  To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message:  unsubscribe s-news





<Prev in Thread] Current Thread [Next in Thread>