From p.murrell at auckland.ac.nz  Mon Jul 28 22:56:30 2008
From: p.murrell at auckland.ac.nz (Paul Murrell)
Date: Tue, 29 Jul 2008 08:56:30 +1200
Subject: [Rd] grid.ls() after grid.remove() fails
In-Reply-To: <94730b8a0807280044g2fc2a3e2ue18ada3fbc14259b@mail.gmail.com>
References: <94730b8a0807280044g2fc2a3e2ue18ada3fbc14259b@mail.gmail.com>
Message-ID: <488E327E.40404@stat.auckland.ac.nz>

Hi



Felix Andrews wrote:
> Dr Murrell and others,
> 
> It seems grid.ls() fails after any use of grid.remove(). It gives an
> infinite recursion error even in the simplest cases, and no matter
> what arguments are passed to grid.ls.


Yep, blatant error in the code.  I will have a fix in the development
version soon.  Thanks for the report!

Paul


>> library(grid)
>> grid.newpage()
>> grid.lines(name="foo")
>> grid.ls()
> foo
>> grid.remove("foo")
>> grid.ls()
> Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
>> grid.ls(recursive=FALSE)
> Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
>> str(grid.ls(print=FALSE))
> Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
>> traceback()
> ...etc...
> ...etc...
> ...etc...
> 13: gridList.default(X[[2L]], ...)
> 12: FUN(X[[2L]], ...)
> 11: lapply(display.list[1:dl.index], gridList, grobs = grobs,
> viewports = viewports,
>         fullNames = fullNames, recursive = recursive)
> 10: gridList.default(X[[2L]], ...)
> 9: FUN(X[[2L]], ...)
> 8: lapply(display.list[1:dl.index], gridList, grobs = grobs, viewports
> = viewports,
>        fullNames = fullNames, recursive = recursive)
> 7: gridList.default(X[[2L]], ...)
> 6: FUN(X[[2L]], ...)
> 5: lapply(display.list[1:dl.index], gridList, grobs = grobs, viewports
> = viewports,
>        fullNames = fullNames, recursive = recursive)
> 4: gridList.default(x, grobs = grobs, viewports = viewports, fullNames
> = fullNames,
>        recursive = recursive)
> 3: gridList(x, grobs = grobs, viewports = viewports, fullNames = fullNames,
>        recursive = recursive)
> 2: grid.ls(print = FALSE)
> 1: str(grid.ls(print = FALSE))
> 
> 
>> str(current.vpTree())
> List of 17
>  $ x             :Class 'unit'  atomic [1:1] 0.5
>   .. ..- attr(*, "unit")= chr "npc"
>   .. ..- attr(*, "valid.unit")= int 0
>  $ y             :Class 'unit'  atomic [1:1] 0.5
>   .. ..- attr(*, "unit")= chr "npc"
>   .. ..- attr(*, "valid.unit")= int 0
>  $ width         :Class 'unit'  atomic [1:1] 1
>   .. ..- attr(*, "unit")= chr "npc"
>   .. ..- attr(*, "valid.unit")= int 0
>  $ height        :Class 'unit'  atomic [1:1] 1
>   .. ..- attr(*, "unit")= chr "npc"
>   .. ..- attr(*, "valid.unit")= int 0
>  $ justification : chr "centre"
>  $ gp            : list()
>   ..- attr(*, "class")= chr "gpar"
>  $ clip          : logi TRUE
>  $ xscale        : num [1:2] 0 558
>  $ yscale        : num [1:2] 557 0
>  $ angle         : num 0
>  $ layout        : NULL
>  $ layout.pos.row: NULL
>  $ layout.pos.col: NULL
>  $ valid.just    : num [1:2] 0.5 0.5
>  $ valid.pos.row : NULL
>  $ valid.pos.col : NULL
>  $ name          : chr "ROOT"
>  - attr(*, "class")= chr "viewport"
> 
> 
>> sessionInfo()
> R version 2.8.0 Under development (unstable) (2008-07-26 r46127)
> i386-pc-mingw32
> 
> locale:
> LC_COLLATE=English_Australia.1252;LC_CTYPE=English_Australia.1252;LC_MONETARY=English_Australia.1252;LC_NUMERIC=C;LC_TIME=English_Australia.1252
> 
> attached base packages:
> [1] grid      stats     graphics  grDevices utils     datasets  methods
> [8] base
> 
> 

-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/



[Rd] grid.ls() after grid.remove() fails
Paul Murrell