[R] Reading in a value of .Random.seed in .Rprofile
Rolf Turner
r.turner at auckland.ac.nz
Wed Aug 20 23:34:45 CEST 2008
For reasons that are best known to myself [ ;-) ] I have a value
of .Random.seed
saved (via dput()) in a file ``.Random.seed.save''.
In my .Rprofile I have the lines:
.Random.seed <- dget(".Random.seed.save")
Junk <- dget(".Random.seed.save")
print(all.equal(.Random.seed,dget(".Random.seed.save")))
print(all.equal(Junk,dget(".Random.seed.save")))
The two calls to all.equal() both return TRUE.
However when I repeat the calls from the command line after the
R session has started, I get TRUE from the second (``Junk'') call
but
[1] "Mean relative difference: 0.1"
from the first.
The value of .Random.seed appears to be that which was there when I quit
the previous R session and not the one that I tried to read in from
the file.
If I *remove* .Random.seed before quitting (and save the workspace,
so that
there is no .Random.seed in .RData then I get TRUE from both calls to
all.equal() made from the command line. I.e. the value of .Random.seed
***is*** the one read in from the file.
Can anyone:
(a) Explain what's going on?
(b) Suggest how I might arrange that the value of .Random.seed be
made equal to that read in from the file?
***PLEASE*** don't tell me to use set.seed() instead, or something
like that.
I ***know*** about set.seed() --- I wasn't born yesterday, y'know!
Please just
accept that I want to do what I want to do, and (if you can) tell me
how.
Ta.
cheers,
Rolf Turner
######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
More information about the R-help
mailing list