Overview

SUMMARY: loading the ggplot2 package produces errors with str which
are not present otherwise.

To obtain the "addgrob.asc.save" file used below, perform the
following steps.  Patch gtable using
[gtableaddgrob.diff](https://bitbucket.org/faheem/gtable-debian/src/tip/patches/gtableaddgrob.diff). Or
you can use the Debian packaging in
https://bitbucket.org/faheem/gtable-debian, along with the script in
this repository
[save.R](https://bitbucket.org/faheem/github-ggplot2-817/src/tip/save.R).

To reproduce this bug, do the following.

Start R. Then

> ls()
character(0)
> load("addgrob.asc.save")
> ls()
[1] "grobs"  "layout" "x"

> str(x, max.level=1)
List of 10
 $ grobs   :List of 8
 $ layout  :'data.frame':       8 obs. of  7 variables:
   $ widths  :Class 'unit'  atomic [1:6] 1.5 6.096 0.762 1.961 0 ...
  .. ..- attr(*, "unit")= chr "mm"
  .. ..- attr(*, "valid.unit")= int 7
 $ heights :Class 'unit'  atomic [1:7] 1.5 2.53 1.52 6.1 6.1 ...
  .. ..- attr(*, "unit")= chr "mm"
  .. ..- attr(*, "valid.unit")= int 7
 $ respect : logi FALSE
 $ rownames: NULL
 $ colnames: NULL
 $ name    : chr "layout"
 $ gp      : NULL
 $ vp      : NULL
 - attr(*, "class")= chr [1:3] "gtable" "grob" "gDesc"

> x$grobs <- c(x$grobs, grobs)
> x$layout <- rbind(x$layout, layout)

> str(x, max.level=1)
List of 10
 $ grobs   :List of 11
 $ layout  :'data.frame':       11 obs. of  7 variables:
   $ widths  :Class 'unit'  atomic [1:6] 1.5 6.096 0.762 1.961 0 ...
  .. ..- attr(*, "unit")= chr "mm"
  .. ..- attr(*, "valid.unit")= int 7
 $ heights :Class 'unit'  atomic [1:7] 1.5 2.53 1.52 6.1 6.1 ...
  .. ..- attr(*, "unit")= chr "mm"
  .. ..- attr(*, "valid.unit")= int 7
 $ respect : logi FALSE
 $ rownames: NULL
 $ colnames: NULL
 $ name    : chr "layout"
 $ gp      : NULL
 $ vp      : NULL
 - attr(*, "class")= chr [1:3] "gtable" "grob" "gDesc"

> library(ggplot2)

> str(x, max.level=1)
List of 11
 $ grobs   :List of 11
 $ layout  :'data.frame':       11 obs. of  7 variables:
   $ widths  :Class 'unit'  atomic [1:6] 1.5 6.096 0.762 1.961 0 ...
  .. ..- attr(*, "unit")= chr "mm"
  .. ..- attr(*, "valid.unit")= int 7
 $ heights :Class 'unit'  atomic [1:7] 1.5 2.53 1.52 6.1 6.1 ...
  .. ..- attr(*, "unit")= chr "mm"
  .. ..- attr(*, "valid.unit")= int 7
 $ respect : logi FALSE
 $ rownames: NULL
 $ colnames: NULL
 $ name    : chr "layout"
 $ gp      : NULL
 $ vp      : NULL
 $ NA:Error in object[[i]] : subscript out of bounds

Loading `ggplot2` does not cause the earlier version of `x` to error
out `str`.

    > ls()
    character(0)
    > load("addgrob.asc.save")
    l> ls()
    [1] "grobs"  "layout" "x"     
    > library(ggplot2)
    > str(x, max.level=1)
    List of 8
     $ grobs   :List of 8
     $ layout  :'data.frame':       8 obs. of  7 variables:
     $ widths  :Class 'unit'  atomic [1:6] 1.5 6.096 0.762 1.961 0 ...
      .. ..- attr(*, "unit")= chr "mm"
      .. ..- attr(*, "valid.unit")= int 7
     $ heights :Class 'unit'  atomic [1:7] 1.5 2.53 1.52 6.1 6.1 ...
      .. ..- attr(*, "unit")= chr "mm"
      .. ..- attr(*, "valid.unit")= int 7
     $ respect : logi FALSE
     $ rownames: NULL
     $ colnames: NULL
     $ name    : chr "layout"
     - attr(*, "class")= chr [1:3] "gtable" "grob" "gDesc"