[R] lm(y~x) question: removing NA´s

Christoph Scherber Christoph.Scherber at uni-jena.de
Tue May 4 15:41:39 CEST 2004


Dear all,

I have a data frame with different numbers of NA´s in each column, e.g.:

x       y  
1      2
NA  3
NA  4
4     NA
1     5
NA NA


I now want to do a linear regression on y~x with all the NA´s removed. 
The problem now is that is.na(x) (and is.na(y) obviously gives vectors 
with different lengths. How could I solve this problem?

Thank you very much for any help.

Best regards
Chris




More information about the R-help mailing list