On Wed, 2004-03-17 at 11:42, klea lambrou wrote: > hello R-users.I really need your help on these one.i have two vectors > x and y of equal length.y contains missing values,so i need to remove > them.i know how to do that for y but i also need the corresponding x > value to be removed too.i cannot find or at least think of a command > which will do this.can you please help me?
Use complete.cases(): x <- c(1:6) y <- c(1, 2, NA, 4, 5, NA) z <- cbind(x, y) > z x y [1,] 1 1 [2,] 2 2 [3,] 3 NA [4,] 4 4 [5,] 5 5 [6,] 6 NA > z[complete.cases(z), ] x y [1,] 1 1 [2,] 2 2 [3,] 4 4 [4,] 5 5 See ?complete.cases for more information. HTH, Marc Schwartz ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html