[R] double for cycle

cesare orsini castjam at hotmail.it
Wed Jul 18 19:39:14 CEST 2012


Hi nice people,

i am trying to made a double "for" cycle, i wish that for cycle on k
activates t times  the for cycle on s 

the first cycle is this:

s<-rep(1,10)
s
 [1] 1 1 1 1 1 1 1 1 1 1

> for (n in 2:10) {
+ s[n]=1+s[n]+rnorm(1,mean=0,sd=1)
+ }
> s
 [1] 1 4.75 4.86 4.05 4.09 4.56 4.63 4.65 4.12 4.01

now i wish another cycle that activates t times the before cycle gives me a
matrix with t columns and 10 rows

like for example if t=3

1                  1                   1
4.75          4.56             4.13
4.86          4.12             4.58
4.05          4.17             4.78
4.09          4.44             4.15
4.56          4.80             4.15
4.63          4.56             4.11
4.65          4.22             4.25
4.12          4.55             4.56
4.01          4.25             4.36

how can i do?
thank you for avalaibility!


--
View this message in context: http://r.789695.n4.nabble.com/double-for-cycle-tp4636916.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list