[R] residuals() with missing data, alignment to original data set

klaus.thul@infineon.com klaus.thul at infineon.com
Tue Jan 14 18:16:02 CET 2003


Hello, 

I have a data frame and want to do the following.

Do a regression of one variable versus another:

	fit <- lm(a ~ b)

Then I would like to plot the residuals of this fit versus a third variable:

	bwplot(residuals(fit) ~ group)

This fails, if a or b contain NAs, because the data in the residuals() -
vector are not aligned anymore to the data in the original data frame.

Is there a way to solve this issue?

Regards and thanks for your help
Klaus




More information about the R-help mailing list