[R] Warnings from script - where?

R. Michael Weylandt <michael.weylandt@gmail.com> michael.weylandt at gmail.com
Mon Feb 13 01:51:36 CET 2012


options(error=browser) or options(error=recover) will be of great help if you don't know them already. 

Michael 

On Feb 12, 2012, at 7:41 PM, Noah Silverman <noahsilverman at ucla.edu> wrote:

> Solved my own question:
> 
> options(warnings=2)  will turn all warnings into errors.  That should halt execution and allow me to examine what happened.
> 
> --
> Noah Silverman
> UCLA Department of Statistics
> 8208 Math Sciences Building
> Los Angeles, CA 90095
> 
> On Feb 12, 2012, at 4:38 PM, Noah Silverman wrote:
> 
>> Hi,
>> 
>> Next challenge today.
>> 
>> I have a script that I call within R:  source("foo.R")
>> When it finishes, I get the dreaded output:  "There were 50 or more warnings (use warnings() to see the first 50)"
>> 
>> So, I type warnings() and get a nice list.  (Same error repeatedly, so probably something I'm using in a loop.)
>> 
>> The difficult part is I have no idea *where* the warning is being generated.  Is there a way to get R to either halt on warning, or give me more detail when listing warnings after execution?
>> 
>> Thanks!
>> 
>> --
>> Noah Silverman
>> UCLA Department of Statistics
>> 8208 Math Sciences Building
>> Los Angeles, CA 90095
>> 
>> ______________________________________________
>> 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.
> 
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> 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