I\'m using a data frame with many NA
values. While I\'m able to create a linear model, I am subsequently unable to line the fitted values of the model up with
If you do not want to change the raw data. Try this way, it's really simple.
names(fitted.values(model))
are data's rownames of available observations, and we can use this feature to add new column:
dat[names(fitted.values(model)), "fitted.values"] <- fitted.values(model)
sum(!is.na(dat[, "fitted.values"]))
# [1] 2745