[R] Debugging R's code: boxplot.stats

Matthew Walker m.g.walker at massey.ac.nz
Sat Oct 28 05:06:34 CEST 2006


Hi everyone,

I think I have found a minor issue with the R function "boxplot.stats".
But before I make such a rash comment, I'd like to check my facts by
fixing what I think is the problem.  However, why I try to do this, R
does not behave as I expect.  Can you tell me what I'm doing wrong?

If I use the command:
debug(boxplot.stats)
I am allowed to step through the code as normal.

I then want to edit the function, so I type:
boxplot.stats <- edit(boxplot.stats)
and I make my changes.

I can check my changes have been made by typing:
boxplot.stats
and the updated version appears on screen.

But now when I come to test my changes, the "debug" functionality has
just up and disappeared; I can no longer step though the function as
normal.  Further to that, it appears that the change has somehow not
been registered, as exactly the same error occurs---although I cannot be
sure that it is occurring inside boxplot.stats.

Does anyone have any tips, suggestions or comments?  I'd love to be able
to fix this.

(For what it's worth I wish to change line 14 of boxplot.stats so that
it reads "if (any(out[nna],na.rm=TRUE))".)


Thank you for your thoughts,

Matthew



More information about the R-help mailing list