vendredi 5 janvier 2018

Why the same random state after 'load()' function

After loading my .RData file from the disc into R, I noticed that the random generator gives the same numbers every time after loading the workspace.

Here is what I mean

load(".../file.RData")
sample(10)
#[1]  9  6  1  7  5  2  8  4 10  3

load(".../file.RData")
sample(10)
#[1]  9  6  1  7  5  2  8  4 10  3

Do you have any idea why this is the case? I don't remember which function did I use to save the workspace but I have the feeling that its the matter of using save() or save.image().

Does save.image() save the random state too?




Aucun commentaire:

Enregistrer un commentaire