[R] Odp: how to iterate

Petr PIKAL petr.pikal at precheza.cz
Tue Jun 26 17:03:28 CEST 2007


Hi

as you did not specify your code (which you said it had failed) I try to 
give you a suggestion how I would do such tasks.

for (i in 1:100)  {

sample(something, no, replace =TRUE)
result <-perform a test
store.a result[i] <- result

}

Regards
Petr


r-help-bounces at stat.math.ethz.ch napsal dne 26.06.2007 16:08:16:

> for the following example dataset:-
>    Category Variable 1 127 1 261 1 142 1 183 1 234 1 162 2 173 2 321 2 
168 2
> 197 2 213 2 261 3 198 3 126 3 167 3 154 3 134 3 187 3 109 3 210
> I have performed Anova on the measured variable (column#2) for the 
groups
> 1,2&3 (column#1). Now I want to randomize the values in C#2 and 
reperform
> the test, say, a hundred times. Please suggest a way for this iteration. 
The
> loop I tried to write didn't work.
> Thanks.
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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