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

From: Felix Andrews <felix_at_nfrac.org>
Date: Fri, 15 Feb 2008 02:22:00 +1100

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


______________________________________________ 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.

Received on Thu 14 Feb 2008 - 15:24:52 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 14 Feb 2008 - 17:30:14 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive