[R] {lattice/grid} "Error using packet 1" and traceback

Felix Andrews felix at nfrac.org
Thu Feb 14 16:22:00 CET 2008


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 / 安福立
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



More information about the R-help mailing list