Re: [R] Combine variables of different length

2011-11-01 Thread R. Michael Weylandt
Perhaps something like this: X = jitter(1:10) Y = jitter(3*X-5, factor = 3) X[3] = NA m = lm(Y~X)$fitted.values fits <- rep(NA, length(X)); fits[as.numeric(names(m))] <- m; cbind(X,Y,fits) Michael On Tue, Nov 1, 2011 at 8:52 AM, Johannes Radinger wrote: > Hi, > > I have got a dataset with > t

[R] Combine variables of different length

2011-11-01 Thread Johannes Radinger
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