From richcalaway at revolution-computing.com  Tue Sep  1 02:18:47 2009
From: richcalaway at revolution-computing.com (Rich Calaway)
Date: Mon, 31 Aug 2009 17:18:47 -0700
Subject: [Rd] Strange interaction of browser() and warnings
Message-ID: <004201ca2a99$c68b47e0$53a1d7a0$@com>

Hi, DevelopeRs,

Consider the following simple function:

myFun <- function(){
	print(log(-1))
	browser()
	print("Bye!")
}

With default settings (in particular, options(warn=0)), if you call this
function and then type only standard browser commands (cont, n, where Q) at
the browser prompt, you see the warning message from printing log(-1)
printed after the final "Bye!":

> myFun()
[1] NaN
Called from: myFun()
Browse[1]> c
[1] "Bye!"
Warning message:
In log(-1) : NaNs produced

However, if you type an ordinary R expression at the browser prompt, you see
the warning message after that expression's output, while still at the
browser prompt:


> myFun()
[1] NaN
Called from: myFun()
Browse[1]> print(2)
[1] 2
Warning message:
In log(-1) : NaNs produced
Browse[1]>

This looks like a bug to me, but admit that I just might not understand
what's going on. So, is it a bug?





Rich Calaway
Documentation Manager
REvolution Computing, Inc.
richcalaway at revolution-computing.com
206-577-4778 x3204



[Rd] Strange interaction of browser() and warnings
Rich Calaway