require - warn.conflicts

About this list Date view Thread view Subject view Author view Other groups

Subject: require - warn.conflicts
From: Paul Gilbert (pgilbert@bank-banque-canada.ca)
Date: Fri 22 Oct 1999 - 01:40:14 EST


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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b25 : Tue 04 Jan 2000 - 14:16:09 EST