[R] removing rows with NAs in anywere

Dimitris Rizopoulos d.rizopoulos at erasmusmc.nl
Wed Dec 23 07:49:54 CET 2009


try this:

myDF[complete.cases(myDF), ]


Best,
Dimitris


milton ruser wrote:
> Dear all,
> 
> I have a data.frame with some NAs that can
> happens anywere, and I would like to keep
> only rows without NAs. Thanks in advance
> for your help, and Merry Xmas.
> 
> myvect<-runif(100)
> myvect[sample(1:100)[1:5]]<-NA
> myDF<-data.frame(matrix(myvect,ncol=5))
> myDF
> miltinho
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

-- 
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus University Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014




More information about the R-help mailing list