From pgilbert@bank-banque-canada.ca  Thu Oct 21 16:40:14 1999
From: pgilbert@bank-banque-canada.ca (Paul Gilbert)
Date: Thu, 21 Oct 1999 11:40:14 -0400
Subject: require - warn.conflicts
Message-ID: <380F33DE.4B06BAC3@bank-banque-canada.ca>

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 (is.na(match(paste("package", name, sep = ":"), search())) &&
        is.na(match(name, .Provided))) {
        if (!quietly)
            cat("Loading required package:", name, "\n")
        library(name, char = TRUE, logical = TRUE,
warn.conflicts=warn.conflicts)
    }
    else TRUE
}


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


require - warn.conflicts
Paul Gilbert