[R] ANOVA with many IV's

Dennis Murphy djmuser at gmail.com
Thu Jun 9 06:14:28 CEST 2011


Hi:

You can try something like this: assuming the factor variables of
interest and the response variable are in a data frame named df,

ivset <- c(<comma separated vector of factor names>)
myaovs <-  lapply(ivset, function(x) {
     form <- as.formula(substitute(yvar ~ foo, list(foo = as.name(x))))
     aov(form, data = df)
   } )

This should generate a list of aov objects, one per factor in ivset.
>From there, R has functions to extract pieces of output as needed.

Since no example data was presented, the above is untested, so caveat emptor.

HTH,
Dennis

On Wed, Jun 8, 2011 at 3:25 PM, mandakaye <mandakaye at gmail.com> wrote:
> I'd like to conduct one-way ANOVA's on multiple IV's. Is there a function for
> "aov (y~"all of my IV's")? Thank you!
>
> --
> View this message in context: http://r.789695.n4.nabble.com/ANOVA-with-many-IV-s-tp3583788p3583788.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list