Sorry that this is quite vague but I'd have to post 100's of lines of proprietary code which I cannot do.
Some R code I've written calls a moderately complicated R function I also wrote. The code, or really the function, seems to fail when I pass an odd-sized block of data to it, but all that happens is R drops out of the function without a return value and prints this message:
Error in if (range[2] - range[1] == 1) return(c(range[1], range[2])) :
missing value where TRUE/FALSE needed
Nothing in my function has anything like
'range[2] - range[1] == 1'
so I assume this is actually generated in some lower level R function but I don't know how to get R to be more clear about where the failure is. I've looked at what's getting passed to my function at the top level and it looks good so the problem is presumably somewhere lower. I'd guess this is caused by some sort of
'(NA - value) ==1'
failing due to the NA but that's just a guess.
How might I get R to be more clear about where the failure is actually occurring, short of print statements line by line in the function? I suspect that tryCatch might be part of the solution but it's not clear to me where I put this. Do I wrap my upper call in a tryCatch or do I place it in the lower function and move it around until it finds something?
Very unclear!