This approach gives the same results:
> set.seed(1)
> for (i in 1:10) print(runif(1))
[1] 0.2655087
[1] 0.3721239
[1] 0.5728534
[1] 0.9082078
[1] 0.2016819
[1] 0.8983897
[1] 0.9446753
[1] 0.6607978
[1] 0.629114
[1] 0.06178627
>
> set.seed(1)
> for (i in 1:5) print(runif(1))
[1] 0.2655087
[1] 0.372
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Ellerbe, Caitlyn Nicole
> Sent: Wednesday, May 08, 2013 11:51 AM
> To: Ellerbe, Caitlyn Nicole; r-help@R-project.org
> Subject: Re: [R] Correctly Setting New
://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
Thanks
John Kane
Kingston ON Canada
> -Original Message-
> From: eller...@musc.edu
> Sent: Wed, 8 May 2013 14:50:42 -0400
> To: eller...@musc.edu, r-help@r-project.org
> Subject: Re: [R] Correctly S
t.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Ellerbe, Caitlyn Nicole
Sent: Wednesday, May 08, 2013 2:06 PM
To: r-help@R-project.org
Subject: [R] Correctly Setting New Seed
Could someone please suggest a method to store the current random seed. I'm
having trouble understanding how to cor
"Crashes" is not a clear description. When I execute the statement:
set.seed(seed)
I get the error
Error in set.seed(seed) : object 'seed' not found
which makes sense because there is no variable defined that is called "seed".
Choose a literal value like 42:
set.seed(42)
or define the variab
Could someone please suggest a method to store the current random seed. I'm
having trouble understanding how to correctly use set.seed and .Random.seed.
Specifically, I have the following code that crashes:
set.seed(seed)
for(i in 1:10){
print( runif(1))
}
To get around this I need to
6 matches
Mail list logo