require - warn.conflicts

Paul Gilbert
Thu, 21 Oct 1999 11:40:14 -0400

I am trying to straighten up my DSE package to use require() as that seems to be
a good mechanism. I have several packages:  dse requires tframe which requires
syskern which masks a few methods in base ( RNGkind rnorm runif).

If  I do require(dse) I get 3 copies of a six line warning (lots of white space)
about syskern methods masking base methods. If I use library(dse) I only get 2.
(I've simplified the situation somewhat,  I really have five or six levels of
requires and lots and lots of warning messages.) It would be nice if a single
warning could be produced, but at least could require() please be modified with
a warn.conflicts argument which is passed to library. Below is a fixed version.

Paul Gilbert

 require <- function (name, quietly = FALSE, warn.conflicts=TRUE)
    name <- as.character(substitute(name))
    if (!exists(".Provided", inherits = TRUE))
        assign(".Provided", character(0), envir = .GlobalEnv)
    if ("package", name, sep = ":"), search())) &&, .Provided))) {
        if (!quietly)
            cat("Loading required package:", name, "\n")
        library(name, char = TRUE, logical = TRUE,
    else TRUE

r-devel mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: