6

I'm familiar with browser(), trace(), traceback(), and options(error=recover). I'm also playing with the debug package, which looks nice. All of these put R miles ahead of other statistical packages I've worked with in terms of debugging facilities. But in comparison to compiled traditional languages, the picture seems less favorable. Which gives rise to two questions:

  1. What debugging facility present in other languages do you miss the most?

  2. Is it possible to add this functionality in R as it exists current, or does it require a compiler, etc.?

Edit: Eliminated my proposed entry since as was pointed out it does exist in R.

9
  • 2
    This question should be reopened. First, the question can be asked and answered objectively. In pseudo R notation, it's like asking setdiff(union(debug functions in language !R), union(debug functions in language R)). Second, although profiling and debugging are different, they're quite related. R lacks a line profiler, which is in several other interpreted languages. Third, someone outside of statistics must've coined the term "statistical profiler". With a little work R could stand peerless in the quality of its statistical profiling. :)
    – Iterator
    Commented Sep 5, 2011 at 0:09
  • 1
    Fourth, although absence of proof is not proof of absence, I am aware that there are some lint-like tools in codetools, but Matlab, for instance, extends this by finding arrays that grow inside of loops.
    – Iterator
    Commented Sep 5, 2011 at 0:19
  • 1
    Finally, having an open question helps because if someone incorrectly asserts functionality X doesn't exist, that error can be found and the user (and everyone else) enlightened as to where to find it. Closing a question like this serves no beneficial purpose.
    – Iterator
    Commented Sep 5, 2011 at 0:20
  • 1
    In any case, users are advised to look at the works of Luke Tierney, Romain Francois, Philippe Grosjean, and Hadley Wickham, for a good many tools for debugging and profiling. Luke Tierney is especially notable for work on profiling, compiling, and much more.
    – Iterator
    Commented Sep 5, 2011 at 0:24
  • 1
    I'll see if I can find examples for PyLint; here's a page with examples of output for Matlab's code checker: mathworks.com/help/techdoc/ref/checkcode.html. This includes suggestions on functions that may be faster than the given one. seq_along may be one such analogue for R.
    – Iterator
    Commented Sep 5, 2011 at 0:39

1 Answer 1

6

I'm afraid you're missing some options in R. You should take a look at the functions Rprof() and summaryRprof() for the -in depth- profiling of code. Next to that, check also the discussion on :

What is your favorite R debugging trick?

And especially the answer of Shane. That has some more interesting tips. There's also a whole chapter on debugging in the Writing R Extensions manual.

Lastly, keep in mind that quite some debugging tools for "compiled traditional languages" are implemented in the IDE, rather than in the language itself. As R can be coupled with Eclipse and Emacs to name a few, all those debugging tools are also available for R.

reworded

2
  • I love R. But that doesn't mean it's absolutely perfect. And my question definitely encompasses the implemented-in-IDE tools that you're referring to, since I've never seen such a tool implemented in an IDE for R (doesn't mean it doesn't exist). I had the favorite R debugging trick thread as one of my favorites. But you'll note that I mentioned most of those functions in my question. My question is simply: what don't I know about that could be added? And thanks for pointing out Rprof(). I learned something already from this thread. Commented Mar 1, 2011 at 15:06
  • @gsk3 : R can be perfectly well coupled with Eclipse, which contains a whole set of debugging tools. R can be used with Emacs, which is the power of God at your fingers. So what exactly is the problem? Do some research first, please.
    – Joris Meys
    Commented Mar 1, 2011 at 15:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.