get.seed() ?

Using set.seed(x) you can generate a new random series... but there is no get.seed() function.
This is because when you are using set.seed(x), you generate a vector of 626 values stored in .Random.seed.

> h0 <- .Random.seed
> set.seed(1)
> h1 <- .Random.seed
> set.seed(0)
> h2 <- .Random.seed
> identical(h0, h2)
[1] TRUE
> identical(h0, h1)
[1] FALSE

If you want get the current seed to use it later, you must store the vector of 626 values:

> set.seed(0)
> h0 <- .Random.seed
> runif(1)
[1] 0.8966972
> runif(1)
[1] 0.2655087
> .Random.seed <- h0
> runif(1)
[1] 0.8966972
> runif(1)
[1] 0.2655087

Commentaires

Posts les plus consultés de ce blog

Standard error from Hessian Matrix... what can be done when problem occurs

stepAIC from package MASS with AICc

Install treemix in ubuntu 20.04