Re: [R] creating functions question

2010-02-15 Thread AC Del Re
Perfect! Thank you, Dimitris. AC On Mon, Feb 15, 2010 at 1:45 PM, Dimitris Rizopoulos wrote: > try this: > > MRfit <- function (...) { >    models <- list(...) >>    do.call(anova, models) >> } >> >> >> I hope it helps. >> >> Best, >> Dimitris >> >> >> AC Del Re wrote: >>> >>> Hi All, >>>

Re: [R] creating functions question

2010-02-15 Thread Dimitris Rizopoulos
try this: MRfit <- function (...) { models <- list(...) do.call(anova, models) } I hope it helps. Best, Dimitris AC Del Re wrote: Hi All, I am interested in creating a function that will take x number of lm objects and automate the comparison of each model (using anova). Here is a

[R] creating functions question

2010-02-15 Thread AC Del Re
Hi All, I am interested in creating a function that will take x number of lm objects and automate the comparison of each model (using anova). Here is a simple example (the actual function will involve more than what Im presenting but is irrelevant for the example): # sample data: id<-rep(1:20)