[Rd] trellis.device in .First (PR#6812)

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Apr 23 09:21:34 CEST 2004


Extract from ?Startup

     Next, if a function '.First' is found on the search path, it is
     executed as '.First()'. Finally, function '.First.sys()' in the
     'base' package is run. This calls 'require' to attach the default
     packages specified by 'options("defaultPackages")'.

so again, this was documented in the (to me) obvious place.

Note `windows' is in package `graphics', a default package specified by
'options("defaultPackages")'.

It is a matter for discussion (with the lattice maintainer) whether 
trellis.device should help you out here by importing the devices from 
package graphics.  I think adding (conditionalized on the platform)

importFrom(graphics, windows, postscript, pdf, pictex, win.metafile, 
           win.print, png, jpeg, bmp, xfig, bitmap)

to its NAMESPACE might be worth considering.  Alternatively,
	device.call <- get(device)
could be put in a try call, followed by a try on 
	getFromNamespace("graphics", device).

BDR

On Fri, 23 Apr 2004, Prof Brian Ripley wrote:

> 1) On the first point, please do read the NEWS file for R 1.9.0.
> 
> .Rprofile and .First have always been run before the default packages are 
> loaded in .First.sys, to allow them to be changed.
> 
> So this *is* a documented change in behaviour, not a bug.  If I do
> 
> .First <- function() {library(lattice); trellis.device()}
> 
> This happens on all platforms.  You need
> 
> .First <- function() {library(graphics); library(lattice); trellis.device()}
> 
> That is true of starting any graphics device in .Rprofile or .First.


-- 
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-devel mailing list