[R] What is a sane way to deal with changes in library loadings after 1.9.0?

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Jul 5 14:55:34 CEST 2004

Your confusion is that you are trying to run scripts from .First.
You did not say so, and that is strongly not recommended, especially if 
they might have errors.

Use R CMD BATCH to run scripts and you will find it much easier.

BTW, please send replies to the individual asking, not just to the list.

On Mon, 5 Jul 2004 a.prioglio at city.ac.uk wrote:

> On Mon, Jul 05, 2004 at 11:51:25AM +0100, Prof Brian Ripley wrote:
> > > Well, I'm certainly new to R. Still without the explicit loading of the
> > > above libraries my scripts while loading on 1.8.1 were definetely not
> > > loading on 1.9.1. I'm using the same account on all machines so I expect
> > > to have the same environment. Or should I?
> > > 
> > > One thing I noticed now, a search() on a 1.8.1 machine after the loading
> > > of the scripts now returns nothing (after encountering an error though).
> > 
> > And what was the error?
> After a call to factanal()
> Error in sc %% S: non conformable arguments
> If the offending line is removed search() returns its normal output
> So it appears that the interpreter environment is affected by
> encountering errors in the script. I did not know or noticed before.
> > 
> > It seems that you have been fiddling with the default set of packages.
> > Have you set R_DEFAULT_PACKAGES?  Have you set option "defaultPackages"?
> > If so, set them to "", or try starting R with --vanilla.
> No the R environment is "vanilla", i.e. no variables set and a call to
> "set" from bash does not show any R variable. R is from official RPM binaries
> for RH9 (on RH9) and the 1.9.1 from the RPM for SuSE 9.0 (on SuSE 9.0).
> The only option changed in the scripts is the width of output for text
> files, which is restored at the end of the script.
> No other option is changed.
> > 
> > Packages utils, graphics and stats are loaded by default on 1.9.1.  And
> > package mva is loaded by default on 1.8.1.  People who answer here tend to
> > assume that people who know enough to change the default packages loaded
> > know enough to revert the changes ....
> This is not my experience. The Changelog document for 1.9.0 indicates 
> clearly that scripts that used to work before 1.9.0 now need to
> explicitly load stats, utils and graphics libraries.
> Indeed these pachages are loaded by default if
> one starts R as an interpreter. This is not my the case, as I explicitly
> stated as I run R with a script loaded with the .First mechanism in
> .Rprofile.
> My confusion derives from the fact that after I had to explicitly
> load/attach the libraries to cope with the changes as described in the
> Changelog document for 1.9.0, I started to experience problems that I did
> not notice before and more intersting even when using the 1.8.1
> version with the same script.
> .
> > 
> > > How can one know what environments are loaded? Calling R --verbose did
> > > not seem to clarify this point.
> > 
> > search()  (attached, not loaded, BTW, as there are loaded namespace 
> > environments which are not attached).
> >
> Well, what I was hoping for was a way to see something from the unix
> shell like R --show-environment (I know it's not on the man page ...) or
> something like --verbose that did report the working environment. By the
> time I get to the R prompt I see nothing.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list