[R] removing ROWS with missing values

Liaw, Andy andy_liaw at merck.com
Thu Mar 16 21:28:44 CET 2006


See ?complete.cases and perhaps ?na.omit.  You can index the matrix by the
output of complete.cases() for the first case, and feed the matrix without
the omitted column to complete.cases() for the others.

Andy

From: mark salsburg
> 
> I am trying to find out if R can recognize specific criteria 
> for removing rows (i.e. a prexisting function)
> 
> I have a matrix myMatrix that is 12000 by 20
> 
> I would like to remove rows from myMatrix that have:
> 
> -999 across all columns
> -999 across all columns but one
> -999 across all columns but two
> -999 across all columns but three
> -999 across all columns but four
> -999 across all columns but five
> 
> (-999 here is my missing value)
> 
> Does R have a function for this, I've explored subset() so far
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list 
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
>




More information about the R-help mailing list