Skip to content
Prev 22485 / 398502 Next

your mail

On Wed, 7 Aug 2002, Jay Pfaffman wrote:

            
Use by()

models<-by(data, list(student), function(thesedata)
	lm(length~elapsed,subset=thesedata))

will return a list of lm() objects.  You can use lapply() to get
information out of these, for example

lapply(models,coef)

returns a list of coefficient vectors or

sapply(models,coef)

binds the vectors into a matrix.  There's an example in help(by)

	-thomas

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._