[Rd] warnings --- wish/bug (PR#1148)

kjetilh@umsanet.edu.bo kjetilh@umsanet.edu.bo
Fri, 26 Oct 2001 21:27:59 +0200 (MET DST)


When R prints warnings, they often go "out of the line", it would be
better if they where wrapped with
writeLines(strwrap ...

I tried to do that , changing the function warnings, but it has only
effect when called explicitely, not when R prints the warnings unasked.

Anyhow, here is the changed warnings:

warnings <-
function (...) 
{
    if (!(n <- length(last.warning))) 
        return()
    names <- names(last.warning)
    cat("Warning message", if (n > 1) 
        "s", ":\n", sep = "")
    for (i in 1:n) {
        out <- if (n == 1) 
            names[i]
        else paste(i, ": ", names[i], sep = "")
        if (length(last.warning[[i]])) {
            temp <- deparse(last.warning[[i]])
            out <- paste(out, "in:", temp[1], if (length(temp) > 
                1) 
                " ...")
        }
        writeLines(strwrap(out), ...)
    }
}


Kjetil Halvorsen

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