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
function

assert = function( condition, ... ) {
  if (!condition) {
    cat(...); cat("\n");
    browser();
  }
  stopifnot(condition);
}
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.

Regards,

/ivo

______________________________________________
R-help@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.

Reply via email to