Skip to content
Prev 179859 / 398506 Next

Traceback NA's to their first appearance

On 10/05/2009 1:01 AM, Benjamin Leutner wrote:
There's no automatic way that I know of, but modifications to your code 
are relatively easy.  any(is.na(x)) will give TRUE if there are any NAs 
in x.  So adding the line

if (any(is.na(x))) browser()

to your code will drop to the browser if this is ever detected; you can 
then debug your code to work out what happened.

Duncan Murdoch