[R] Error in { : task 3 failed - "NA/NaN argument"

Joshua Wiley jwiley.psych at gmail.com
Mon Jan 31 01:00:21 CET 2011

Hi Jim,

On Sun, Jan 30, 2011 at 2:38 PM, Maas James Dr (MED) <J.Maas at uea.ac.uk> wrote:
> I'm attempting to run a rather complex routine that involves a few loops, and even some use of foreach and doMPI.  I just added another external loop and now get this error message.

Well the fact that the error started occurring after you "added
another external loop" suggests that is a place to start looking.

> Error in { : task 3 failed - "NA/NaN argument"

I am completely guessing here, but "NA/NaN" makes me think of taking
the square root or log of a negative number (or some other similar
computation that is reasonable with certain numbers but returns NaN
for others) and could be causing an error later on.  If there is
anything like that in your code, I might look there first.

> Is there a way to debug what is causing this error or where?

You can try:


You could also put some cat() statements in your code at different
stages or something similar to try to narrow it down.

>  I really have no idea what "task 3" is?

It is difficult to say since we only know you are trying to do a
"complex routine".  See if you can narrow down where it is some with
traceback() or debug() or putting checks in your code at different
stages.  If it has something to do with foreach or doMPI (which task
vaguely sounds like it might), you might also consider sig HPC.



> Thanks
> Jim
> ===============================
> Dr. Jim Maas
> University of East Anglia
> ______________________________________________
> 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.

Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles

More information about the R-help mailing list