Skip to content
Prev 16905 / 398502 Next

Help with accessing elements of a list

On Mon, 4 Feb 2002, anthony staines wrote:

            
It would be slightly more elegant (but equivalent) to write
 wg <- by(xx, xx$mrn, function(xx) lm(maternal.wt ~ gestation,  data=xx))
Well, if you had one of these you would use coef(one.of.these) to get the
coefficients, so given an entire list you could use
   sapply(wg,coef)
to return the 293x2 matrix of coefficients.

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