Re: [R] set.seed and for loop

2011-06-09 Thread Petr Savicky
On Thu, Jun 09, 2011 at 10:14:48AM -0500, Soyeon Kim wrote: > Dear All, > > This is hard to describe so I made a simple example. > set.seed(1001) > total <- 0 > data <- vector("list", 30) > for(i in 1:30) { > data[[i]] <- runif(50) > } > Let's call a data set runif(50). > While the for loop is r

Re: [R] set.seed and for loop

2011-06-09 Thread Uwe Ligges
org [mailto:r-help-boun...@r-project.org] On Behalf Of Soyeon Kim Sent: 09 June 2011 16:15 To: r-help Subject: [R] set.seed and for loop Dear All, This is hard to describe so I made a simple example. set.seed(1001) total<- 0 data<- vector("list", 30) for(i in 1:30) { data[[i]]<

Re: [R] set.seed and for loop

2011-06-09 Thread Duncan Murdoch
0) > for(i in 1:30) { >data[[i]]<- runif(50) > } > set.seed(1001) > data[[23]]<- runif(50) > > HTH > Samuel > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Soyeon Kim >

Re: [R] set.seed and for loop

2011-06-09 Thread Duncan Murdoch
0) > for(i in 1:30) { >data[[i]]<- runif(50) > } > set.seed(1001) > data[[23]]<- runif(50) > > HTH > Samuel > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Soyeon Kim >

Re: [R] set.seed and for loop

2011-06-09 Thread R Help
t;- runif(50) > } > set.seed(1001) > data[[23]] <- runif(50) > > HTH > Samuel > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Soyeon Kim > Sent: 09 June 2011 16:15 > To: r-help > Subject: [R] set

Re: [R] set.seed and for loop

2011-06-09 Thread jim holtman
ed(1001) > total <- 0 > data <- vector("list", 30) > for(i in 1:30) { >  data[[i]] <- runif(50) > } > set.seed(1001) > data[[23]] <- runif(50) > > HTH > Samuel > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r

Re: [R] set.seed and for loop

2011-06-09 Thread Samuel Le
Of Soyeon Kim Sent: 09 June 2011 16:15 To: r-help Subject: [R] set.seed and for loop Dear All, This is hard to describe so I made a simple example. set.seed(1001) total <- 0 data <- vector("list", 30) for(i in 1:30) { data[[i]] <- runif(50) } Let's call a data set runif(50)

Re: [R] set.seed and for loop

2011-06-09 Thread Duncan Murdoch
On 09/06/2011 11:14 AM, Soyeon Kim wrote: Dear All, This is hard to describe so I made a simple example. set.seed(1001) total<- 0 data<- vector("list", 30) for(i in 1:30) { data[[i]]<- runif(50) } Let's call a data set runif(50). While the for loop is running, 100 data sets are generated. I

Re: [R] set.seed and for loop

2011-06-09 Thread R Help
There are certainly people that would know how the random functions work better than I, but I believe you would need to simulate 22 datasets and then get the 23rd dataset. So to restore the 23rd: set.seed(1001) for(i in 1:22){ garbage = runif(50) } data[[23]] = runif(50) Hope that helps, Sam

[R] set.seed and for loop

2011-06-09 Thread Soyeon Kim
Dear All, This is hard to describe so I made a simple example. set.seed(1001) total <- 0 data <- vector("list", 30) for(i in 1:30) { data[[i]] <- runif(50) } Let's call a data set runif(50). While the for loop is running, 100 data sets are generated. I want to restore 23th data set (the data se