Re: [Rd] Two submitted packages

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Tue 05 Sep 2006 - 21:15:37 GMT

On Mon, 4 Sep 2006, Richard M. Heiberger wrote:

> ## This example runs in R 2.3.1 and does not run in R 2.4.1. I am

There is no '2.4.1', and your R-devel is not very recent. It looks as if R-devel has detected an error of yours that previously went undetected.

You set cpv$clip <- "off" and the internal code assumes that it is logical (as the message says). I can't find any documentation to support your code: if there is some please report it to the maintainer of grid (Paul Murrell).

> ## raising it here for two questions: one on how to debug functions
> ## inside a namespace, the other on how to control clipping.
>
> tmp <- data.frame(x=1:5, y=1:5, a=factor(c(1,1,1,1,1), levels=1:4))
> xyplot(y ~ x,
> data=tmp, ylim=c(1.5,4.5),
> panel=function(x,y, ...) {
> cpv <- current.viewport()
> cpv$clip <- "off"
> pushViewport(cpv)
> panel.xyplot(x, y, ...)
> popViewport()
> })
>
> ## R version 2.4.0 Under development (unstable) (2006-08-14 r38872)
> ## gives the error message
> Error in grid.Call.graphics("L_setviewport", pvp, TRUE) :
> LOGICAL() can only be applied to a 'logical', not a 'character'
> >
>
> ## Question 1. How do I place a trace() on grid.Call.graphics to make
> ## it stop and give me a traceback. I tried many variations of the
> ## command
> ## trace(grid:::grid.Call.graphics, exit=recover,
> ## where=environment(grid:::grid.Call.graphics))
> ## None of them trapped the error and let me trace it. What is the
> ## correct incantation?

Not sure why you want to do that, as traceback() works here.

> traceback(max.lines=3)

10: .Call.graphics(fnname, ..., PACKAGE = "grid")

9: grid.Call.graphics("L_setviewport", pvp, TRUE)
8: push.vp.viewport(X[[1]], ...)
7: FUN(X[[1]], ...)
6: lapply(vps, push.vp, recording)
5: pushViewport(cpv)
4: panel(x = c(1, 2, 3, 4, 5), y = c(1, 2, 3, 4, 5), packet.number = 1, 
       panel.number = 1)

3: do.call("panel", pargs)
2: print.trellis(list(formula = y ~ x, as.table = FALSE, aspect.fill = TRUE,
       legend = NULL, panel = function (x, y, ...) 
       {
     ...
1: print(list(formula = y ~ x, as.table = FALSE, aspect.fill = TRUE, 
       legend = NULL, panel = function (x, y, ...) 
       {
     ...

as does options(error=recover). What does a namespace have to do with this?

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed Sep 06 07:22:41 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 06 Sep 2006 - 11:39:29 GMT.

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