[R] ANOVA stuffs_How to save each result from FOR command?

Liviu Andronic landronimirc at gmail.com
Tue Oct 19 13:53:40 CEST 2010


Hello

On Tue, Oct 19, 2010 at 12:16 PM, BumSeok Jeong <bumseok.jeong at gmail.com> wrote:
> Dear R experts,
>
> I'm new in R and a beginner in terms of statistics.
> It should be simple question, but definitely difficult to solve it by
> myself.
>
> I'd like to see main effect of group(gender: sample size is
> different(M:F=23:18) and one of condition(cond) and the interaction at each
> subset from 90 datasets
> So I perform anova 90 times using a command like below;
>
> for(i in 1:90) {results_ezANOVA = ezANOVA(data=subset(ast.ast_coef,
> ast.ast_coef$coef_thr==i), dv=.(ast.values), between=.(gender), wid=.(subj),
> within=.(cond))}
>
> But I got the last(90th) result, not all.
> Here are my questions.
>
> 1) Is my command correct?
> 2) If correct, please let me know if I can get all 90 results.
>
You may want to investigate the apply family of functions [1]. These
can do what loops do, but they can automatically store the results in
a list for you. Regards
Liviu

[1] http://cran.r-project.org/doc/Rnews/Rnews_2008-1.pdf


> 3) What kind of postHoc would be appropriate?
>
> Thank you,
>
> Jeong
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>



-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail



More information about the R-help mailing list