[R] warnings and errors

Gabor Grothendieck ggrothendieck at gmail.com
Thu Jul 30 12:52:47 CEST 2009


Place a cat statement at the top and bottom of each script.

You can force warnings to be treated like errors using options(warn = 2).
options(warn = 0) turns it back again.

On Thu, Jul 30, 2009 at 6:30 AM, Jan M. Wiener<mail at jan-wiener.net> wrote:
> Hi,
>
> I am using R for a while now, but I have not yet been able to convince R
> to produce helpful warnings or error messages. If you run a script that
> sources other scripts it may take a while to understand which script
> produced an error or a warning. For example, R tells you that warnings
> exist and asks you to call warnings() which then tell you the call that
> produced the warning but does not tell you from where the call originated.
>
> I have seen the debug function,  but I find that rather complicated, as
> one has to choose from a menu if errors occur and warnings are not
> reported.
>
> What I (one?) would love to have is a simple (standard) output that
> tells you the filename and the line-number that produced an
> error/warning. I find it hard to belief that this does not exist, and
> would be most grateful for any suggestions.
>
> jan
>
> --
> Dr. Jan M. Wiener
> Centre for Cognitive Science
> University of Freiburg, Institute of Computer Science and Social Research (IIG)
> Friedrichstr. 50, D-79098 Freiburg, GERMANY
> -
> e-mail: mail at jan-wiener.net
> phone: ++49 (0)761 203 4951
> url: www.jan-wiener.net
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list