Skip to content
Prev 105676 / 398506 Next

Adding terms to a function

How about this:

form <- formula(paste("y ~", paste("x", 1:n, sep="",  collapse=" + ")))
model <- lm(form)

HTH,

Simon.
Brooke LaFlamme wrote: