Re: [R] Forcing results from lm into datframe

2010-12-23 Thread beatlebg
Hi all, This subject treats exactly what I am looking for, thank you. Only I would like to include the p-values (or t-values) in the dataframe, like this: .id (Intercept) p-value(intercept) quartile p-value(intercept) 1 CBP090802020.92140 0.00

Re: [R] Forcing results from lm into datframe

2010-10-26 Thread Hadley Wickham
On Tue, Oct 26, 2010 at 11:55 AM, Dennis Murphy wrote: > Hi: > > When it comes to split, apply, combine, think plyr. > > library(plyr) > ldply(split(afvtprelvefs, afvtprelvefs$basestudy), >         function(x) coef(lm (ef ~ quartile, data=x, weights=1/ef_std))) Or do it in two steps: models <- d

Re: [R] Forcing results from lm into datframe

2010-10-26 Thread Dennis Murphy
> From: David Winsemius [dwinsem...@comcast.net] > Sent: 26 October 2010 16:37 > To: Small Sandy (NHS Greater Glasgow & Clyde) > Cc: r-help@r-project.org > Subject: Re: [R] Forcing results from lm into datframe > > On Oct 26, 2010, a

Re: [R] Forcing results from lm into datframe

2010-10-26 Thread Henrique Dallazuanna
Try this: sapply(by(x, x$basestudy, lm, formula = ef ~ quartile), coef) On Tue, Oct 26, 2010 at 1:08 PM, Small Sandy (NHS Greater Glasgow & Clyde) < sandy.sm...@nhs.net> wrote: > Hi > > I need some help getting results from multiple linear models into a > dataframe. > Let me explain the problem.

Re: [R] Forcing results from lm into datframe

2010-10-26 Thread David Winsemius
d Winsemius [dwinsem...@comcast.net] Sent: 26 October 2010 16:37 To: Small Sandy (NHS Greater Glasgow & Clyde) Cc: r-help@r-project.org Subject: Re: [R] Forcing results from lm into datframe On Oct 26, 2010, at 8:08 AM, Small Sandy (NHS Greater Glasgow & Clyde) wrote: Hi I need some help g

Re: [R] Forcing results from lm into datframe

2010-10-26 Thread Small Sandy (NHS Greater Glasgow & Clyde)
nsemius [dwinsem...@comcast.net] Sent: 26 October 2010 16:37 To: Small Sandy (NHS Greater Glasgow & Clyde) Cc: r-help@r-project.org Subject: Re: [R] Forcing results from lm into datframe On Oct 26, 2010, at 8:08 AM, Small Sandy (NHS Greater Glasgow & Clyde) wrote: > Hi > > I need some h

Re: [R] Forcing results from lm into datframe

2010-10-26 Thread David Winsemius
On Oct 26, 2010, at 8:08 AM, Small Sandy (NHS Greater Glasgow & Clyde) wrote: Hi I need some help getting results from multiple linear models into a dataframe. Let me explain the problem. I have a dataframe with ejection fraction results measured over a number of quartiles and grouped

[R] Forcing results from lm into datframe

2010-10-26 Thread Small Sandy (NHS Greater Glasgow & Clyde)
Hi I need some help getting results from multiple linear models into a dataframe. Let me explain the problem. I have a dataframe with ejection fraction results measured over a number of quartiles and grouped by base_study. My dataframe (800 different base_studies) looks like > afvtprelvefs base