On Aug 9, 2010, at 7:51 AM, moleps wrote:

Dear all,

I´m having trouble getting a list of regression variables back into a dataframe.

mydf <- data.frame(x1=rnorm(100), x2=rnorm(100), x3=rnorm(100))

mydf$fac<-factor(sample((0:2),replace=T,100))

mydf$y<- mydf$x1+0.01+mydf$x2*3-mydf$x3*19+rnorm(100)

dlply(mydf,.(fac),function(df) lm(y~x1+x2+x3,data=df))->dl

here I´d like to use

ldply(dl,coef(summary)) or something similar but I cant figure it out...

dfdl <- ldply(dl, function(x) coef(summary(x)) )

Doesn't create a grouping variable, so:

dfdl$group=rep(0:2, each=4)


David Winsemius, MD
West Hartford, CT

______________________________________________
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