Another option: lapply(ls(patt="^m[0-9]"), function(model)summary(get(model)))
On 22/02/2008, Christoph Scherber <[EMAIL PROTECTED]> wrote: > Dear R users, > > Let´s say I have 10 models, each named m1,m2,m3..., and I would like to > summarize them automatically > and simultaneously - e.g., to extract parameter estimates later on from all > models; how can I do that? > > I have tried: > > x=1:10 #this creates some example data > y=rnorm(10) > > m1=lm(x~y) > m2=lm(x~1) > > sum.lms=function(x)summary(paste("m",x,sep="")) > sum.lms(1:2) > > but the paste() function always returns "m1" "m2" in quotation marks instead > of m1 m2 > > Do you know a way around this? I guess I would need to use expression() or > substitute() but I don´t > know how to construct m1, m2... without the quotation marks. > > Thanks very much for your help! > > Best wishes, > > Christoph > > > (using R 2.5.1 on Windows XP SP2) > > > > -- > Dr. Christoph Scherber > DNPW, Agroecology > University of Goettingen > Waldweg 26 > D-37073 Goettingen > Germany > > phone +49(0)551 39 8807 > fax +49(0)551 39 8806 > homepage www.gwdg.de/~cscherb1 > > ______________________________________________ > 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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O ______________________________________________ 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.