[R] debugging

ivo welch ivowel at gmail.com
Mon Sep 1 20:42:21 CEST 2008

dear R wizards---I am not sure at what point I owe pennance for asking
so many questions.  I am now wrangling debugging.  I want to write a

assert = function( condition, ... ) {
  if (!condition) {
    cat(...); cat("\n");
assert( nrow(ds)==12, "My data set has ", nrow(ds), ", rows which is a
bad error.");

(Please ignore my semicolons.)  Then, having invoked "browser()", I
would like by hand to be able to move back up one stack frame so that
I can look at my variables there.  Alas, two "little" problems.
First, the cat() does not seem to work.  It prints the arguments
themselves, rather than 'nrow(ds)'.  Second, I have no idea how to
move up one stack frame to the calling function so that I can examine
better what went wrong.  Is this possible?

As always, advice is highly appreciated.



More information about the R-help mailing list