I assume you mean regression of x on y... here's the code:
missing = is.na(x) predicted = predict(lm(x~y)) x[missing] = predicted[missing]; Should work but please check. Peter On Thu, Oct 14, 2010 at 10:14 PM, Jumlong Vongprasert <jumlong.u...@gmail.com> wrote: > Dear all > I have data (x,y) with data x is missing in 5 record of 100 record. > I want to impute data x by use regression. > How I can do this. > THX > Jumlong ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.