[R] Saved Session Pitfalls (was: ask help!)

Jan Kim jttkim at googlemail.com
Thu Jul 25 13:45:42 CEST 2013

On Thu, Jul 25, 2013 at 08:01:50PM +1000, Jim Lemon wrote:
> On 07/25/2013 07:44 PM, mei_yuan wrote:
> >Hi,
> >
> >In the R console, I have the following:
> >
> >>runif(10)
> >Error in runif(10) :
> >   '.Random.seed' is not an integer vector but of type 'list'
> >>
> >
> >
> >Can someone advise me of the solution of the problem?
> >
> >
> >
> >Mei-Yuan Chen
> Hi Mei-Yuan,
> .Random.seed should be a vector of numeric values. Somehow this has
> been set to an object of type "list":
> .Random.seed<-list(.Random.seed)
> runif(10)
> Error in runif(10) :
>   '.Random.seed' is not an integer vector but of type 'list'
> I would suggest quitting R and _not_ saving the session, then
> restarting and trying:
> runif(10)
> again.

Not saving the session won't help if the previously saved session
(still containing the broken .Random.seed) still lingers around.

So the fix is to start a fresh R session without restoring the
previous workspace (e.g. ``R --no-restore''), and then saving
that. This will lose all previously created stuff, though (which
is something to be aware of in case the workspace contains some
precious unsaved data).

Alternatively, if you run


the ``runif(10)'' call will work again (and create a new .Random.seed
of the right type as a side effect). Then when you quit, do save
the workspace to fix the problem "permanently".

Generally, I recommend disabling automatic saving and restoring of
workspaces, e.g. by aliasing R to ``R --no-save --no-restore'',
and using the save and load functions explicitly where needed;
I've seen (way too) many workspaces that have accumulated phenomenal
amounts of clutter and generating quite a share of "mysterious"
failures and irreproducibilities caused by this auto-save

Best regards, Jan
 +- Jan T. Kim -------------------------------------------------------+
 |             email: jttkim at gmail.com                                |
 |             WWW:   http://www.jtkim.dreamhosters.com/              |
 *-----=<  hierarchical systems are for files, not for humans  >=-----*

More information about the R-help mailing list