From ripley@stats.ox.ac.uk  Fri Oct 26 20:39:14 2001
From: ripley@stats.ox.ac.uk (ripley@stats.ox.ac.uk)
Date: Fri, 26 Oct 2001 21:39:14 +0200 (MET DST)
Subject: [Rd] warnings --- wish/bug (PR#1148)
Message-ID: <200110261939.VAA03615@pubhealth.ku.dk>

This is difficult.  The internal warnings should work as often as
possible without doing memory allocation, which might provoke an error
(*and* we try to print out warnings after a memory allocation error).
So strwrap is a no-no internally.

I've not seen warnings that are not wrapped by the console
(on Unix) or are scrollable (Rgui).   Can you give us an example of the
problem?

Incidentally, I think you want to strwrap the ... too.

On Fri, 26 Oct 2001 kjetilh@umsanet.edu.bo wrote:

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

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


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


[Rd] warnings --- wish/bug (PR#1148)
ripley@stats.ox.ac.uk