[Rd] pos option to function 'library'

From: <Mark.Bravington_at_csiro.au>
Date: Wed 31 Aug 2005 - 07:33:56 GMT

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

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
TAS ph (+61) 3 6232 5118
fax (+61) 3 6232 5012
mob (+61) 438 315 623

R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed Aug 31 17:40:49 2005

This archive was generated by hypermail 2.1.8 : Mon 24 Oct 2005 - 22:27:46 GMT