开发者

How do I track down where a R package function fails? [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

General suggestions for debugging R?

I've encountered an error when calling a function from an R package. Briefly,

> library(treemap)
> ...
> tmPlot(X,index=c("r1","r2","r3","r4"),vSize="size")
Error in if (maxI == 1) { : missing value where TRUE/FALSE needed

This SO question gives more details.

I examined the source code of tmPlot by typing tmPlot at the R prompt, but the line that fails doesn't appear in the function. Which means, I assume, that it's failing in some function cal开发者_高级运维led by tmPlot.

What's the best way to track this down? For example, can I generate a stack trace somehow? Is there an interactive debugger that will allow me to step through and see where the error happens?


traceback will print the call stack.

traceback()

Also, have a look at the on-line help for the debug function. Although I have seen better interactive debuggers, there is some basic functionality provided by debug(), debugonce() and undebug()

?base::debug
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜