Wolfram Fischer
2008-Feb-14 10:14 UTC
[R] {lattice/grid} "Error using packet 1" and traceback
On some errors during the plot of a lattice/grid graphics, there is written a message like "Error using packet 1: missing value where TRUE/FALSE needed" into the concering panel and the next panel is plotted. Which option I could use to stop the execution to have a look at the error by a traceback? Regards - Wolfram
Felix Andrews
2008-Feb-14 15:22 UTC
[R] {lattice/grid} "Error using packet 1" and traceback
You can tell Lattice to stop when an error occurs, like this: lattice.options(panel.error="stop") xyplot(1:10 ~ 1:10, panel=function(...) stop("foo")) # -> Error in panel(x = 1:10, y = 1:10) : foo That is a little more informative than the default "panel.error", because it tells you the conditionCall as well as the conditionMessage. But unfortunately, traceback() will still not work as you expect, it will say something unhelpful about tryCatch() inside print.trellis(). As far as I know there is no way to recover the call stack from an error once it has been caught by tryCatch. (I would be very happy to be proved wrong...) As a work-around, you could call the panel function directly. Probably the best way to do that is to start with a lattice plot using the default panel function, and then trellis.focus() do.call("my.panel.xyplot", trellis.panelArgs()) Felix On Thu, Feb 14, 2008 at 9:14 PM, Wolfram Fischer <wolfram at fischer-zim.ch> wrote:> On some errors during the plot of a lattice/grid graphics, there is written > a message like "Error using packet 1: missing value where TRUE/FALSE needed" > into the concering panel and the next panel is plotted. > > Which option I could use to stop the execution to have a look > at the error by a traceback? > > Regards - Wolfram > > ______________________________________________ > R-help at 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. >-- Felix Andrews / $B0BJ!N)(B PhD candidate Integrated Catchment Assessment and Management Centre The Fenner School of Environment and Society The Australian National University (Building 48A), ACT 0200 Beijing Bag, Locked Bag 40, Kingston ACT 2604 http://www.neurofractal.org/felix/ 3358 543D AAC6 22C2 D336 80D9 360B 72DD 3E4C F5D8