Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What might have caused R to behave like setting the seed to a specified number at startup?

I have used the following as an example

x <- 1:12
sample(x)

Whenever I restart RStudio or Rgui and run that code, I always get the same result:

 [1]  7  3 10  8  2  9 11  4 12  5  1  6

Is there a way to change this annoying behavior?

> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=Greek_Greece.1253  LC_CTYPE=Greek_Greece.1253   
[3] LC_MONETARY=Greek_Greece.1253 LC_NUMERIC=C                 
[5] LC_TIME=Greek_Greece.1253    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base 
like image 732
George Dontas Avatar asked Nov 11 '22 05:11

George Dontas


1 Answers

Explicitly include a line: set.seed(NULL)

like image 120
ddunn801 Avatar answered Nov 15 '22 05:11

ddunn801