[Rd] pos option to function 'library'

Mark.Bravington@csiro.au Mark.Bravington at csiro.au
Wed Aug 31 09:33:56 CEST 2005

At the moment, the 'pos' argument to 'library' defaults to 2. Would it
be possible to change this default to something functionally like the

pos= if( is.null( pos.expr <- getOption( 'library.pos.default.expr'))) 2
else eval( pos.expr)

The proposal is fully back-compatible in that 'pos' still defaults to 2
unless the user (or a package) sets the option. The point of the change
is to allow flexibility in the default attachment position. The
'mvbutils' package needs to be able to attach packages at default
positions lower than 2, otherwise its chain of workspaces gets confused.
For the last three years, I've done this by modifying 'library' itself
so that 'pos' defaults to the functional equivalent of the above, but
I'd prefer not to have to hack a system function.

Slightly more readable would be



default.lib.pos <- function() if( is.null( pos.expr <- getOption(
'library.pos.default.expr'))) 2 else eval( pos.expr)

is defined inside 'library'.

Mark Bravington
CSIRO Mathematical & Information Sciences
Marine Laboratory
Castray Esplanade
Hobart 7001

ph (+61) 3 6232 5118
fax (+61) 3 6232 5012
mob (+61) 438 315 623

More information about the R-devel mailing list