[R] Reading in a value of .Random.seed in .Rprofile

Ray Brownrigg Ray.Brownrigg at mcs.vuw.ac.nz
Thu Aug 21 02:49:27 CEST 2008


Hi Rolf:

I think this is a case of RTFM.  ?.Rprofile tells you that the profile is executed before 
the workspace is restored.

Initially I thought this might be similar to bug PR#12567 that I filed this week, but now 
I think not necessarily.

Cheers,
Ray

On Thu, 21 Aug 2008, Rolf Turner wrote:
> 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}}
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html and provide commented, minimal,
> self-contained, reproducible code.



More information about the R-help mailing list