[R] Combine variables of different length
Johannes Radinger
JRadinger at gmx.at
Tue Nov 1 13:52:18 CET 2011
Hi,
I have got a dataset with
the variables Y,X1,X2,X3.
Some of these variables contain NAs. Therefore
incomplete datasets aren't recognized when
I am doing a regression like:
model <- lm(Y~X1+X2+X3)
so the resulting vector of resid(model) is
obviousely shorter then the original variables.
How can I combine the residuals-vector with
the original dataset (Y,Xi,...). I recognize
that the residuals give also a kind of an index
like from the row names (2,5,7,8,9,12)...
Is it possible to use in such a case the
data.frame command? Or what is the best
way to attach the resulting residuals back to
the original dataframe with incomplete datasets?
thanks
/Johannes
--
More information about the R-help
mailing list