Hi,

First let me say I am a big fan of R and appreciate all your time and
effort.

The update() function does not seem to work in a for loop.  Consider the
following:

mdat <- matrix(c(1,2,3, 11,23,13, 12,4,8), nrow = 3, ncol=3, byrow=TRUE)
reg <- lm(mdat[7:9]~1)
for(i in 1:2) {
reg <- update(reg,.~.+mdat[((i-1)*3 + 1):(i*3)]) #update reg twice
}
reg # reg should have two independent variables, but it only has one



The update() function in conjunction with a for loop will only consider the
last update, and not save all the previous ones.  Is there a way around
this?

I appreciate your time.

- Ben Godlove

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to