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

From: Charles C. Berry <cberry_at_tajo.ucsd.edu>
Date: Wed, 20 Aug 2008 20:24:52 -0700

On Thu, 21 Aug 2008, Rolf Turner wrote:

>
> On 21/08/2008, at 10:21 AM, Charles C. Berry wrote:
>
>> 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.
>>
>> Not on my computer.
>
> Hmmmm. Why do these always happen to ***me*** and only to me?
>>
>> I get TRUE twice whether at start up, source()ing .Rprofile, or C-c C-n'ing
>> the lines from emacs ESS.
>>
>> I have to type
>>
>> load(".RData")
>>
>> _after_ startup to get behavior like you describe.
>>
>>
>> Perhaps, you have something later in your .Rprofile that specifically
>> load()'s your old .RData?
>
> No I haven't. And that couldn't be the case, since ``Junk'' is
> there
> (it wasn't there in the saved image).
>
> So it would seem that what is happening is that the saved .RData is
> being loaded or restored
> ***after*** the commands to read in .Random.seed (and Junk) are
> issued. The .Random.seed
> in the saved image then overwrites the .Random.seed that was just
> read in.
>
> But why does this happen on *my* system, and not on Chuck's???

Because I goofed by rerunning ALL the lines in .Rprofile rather than just the last two. When I run just the last two, I get the behavior you describe.

Sorry for the misdirection.

Chuck

Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry_at_tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901

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. Received on Thu 21 Aug 2008 - 03:30:31 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 21 Aug 2008 - 04:33:59 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive