[R] remove pairs of missing values

Jan Goebel jgoebel at diw.de
Wed Mar 17 19:23:15 CET 2004


not.ok <- is.na(y)
y.new <- y[! not.ok]
x.new <- x[! not.ok]

should work.

jan

On Wed, 17 Mar 2004, 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?
> ______________________________________________
> R-help at stat.math.ethz.ch 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

-- 
+-----------------------------------------
 Jan Goebel 
 j g o e b e l @ d i w . d e

 DIW Berlin 
 German Socio-Economic Panel Study (GSOEP) 
 Königin-Luise-Str. 5
 D-14195 Berlin -- Germany --
 phone: 49 30 89789-377
+-----------------------------------------




More information about the R-help mailing list