[R] Double for loop

From: sigalit mangut-leiba <smangut_at_gmail.com>
Date: Thu, 26 Jun 2008 11:23:14 +0300


Hi,
I'm trying to do a double for loop like this: for (k in 1:1000){
for (i in 1:200){
y[i]<-rbinom(1,1,0.8)
x1[i]<-ifelse(y[i]==1,rnorm(1,mean=20, sd=2),rnorm(1,mean=16, sd=2.2)) ....
}

for (j in 1:300){
....
}
}

Does anyone know a good reference about double loops? Thank you,
Sigalit

        [[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. Received on Thu 26 Jun 2008 - 08:30:36 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 26 Jun 2008 - 10:31:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive