R devel issue: no slot of name "generator" for this object of class "refObjectGenerator"

200 views
Skip to first unread message

Henrik Bengtsson

unread,
Nov 4, 2012, 12:05:51 AM11/4/12
to ggp...@googlegroups.com
FYI, with R Under development (unstable) (2012-11-01 r61067), I get an error that I think is related to recent updates on S4 in R devel, e.g.

"setRefClass() and getRefClass() now return class generator functions, similar to setClass(), but still with the reference fields and methods as before (suggestion of Romain Francois)." [http://cran.r-project.org/bin/windows/base/NEWS.R-devel.html]

I post it here, in case it's something that ggplot2 is doing incorrectly (although I don't think so).  If not, feel free to report/forward this to the R devel mailing list.

REPRODUCIBLE EXAMPLE:

> library(ggplot2)
> example(ggplot)
ggplot> df <- data.frame(gp = factor(rep(letters[1:3], each = 10)),
ggplot+                  y = rnorm(30))
ggplot> # Compute sample mean and standard deviation in each group
ggplot> library(plyr)
ggplot> ds <- ddply(df, .(gp), summarise, mean = mean(y), sd = sd(y))
ggplot> # Declare the data frame and common aesthetics.
ggplot> # The summary data frame ds is used to plot
ggplot> # larger red points in a second geom_point() layer.
ggplot> # If the data = argument is not specified, it uses the
ggplot> # declared data frame from ggplot(); ditto for the aesthetics.
ggplot> ggplot(df, aes(x = gp, y = y)) +
ggplot+    geom_point() +
ggplot+    geom_point(data = ds, aes(y = mean),
ggplot+               colour = 'red', size = 3)
Error in eval(expr, envir, enclos) :
  no slot of name "generator" for this object of class "refObjectGenerator"

> traceback()
13: eval(expr, envir, enclos)
12: eval(expr, p)
11: eval.parent(substitute(x@generator$name))
10: Scales$new
9: Scales$new
8: structure(list(data = data, layers = list(), scales = Scales$new(),
       mapping = mapping, theme = list(), coordinates = coord_cartesian(),
       facet = facet_null(), plot_env = environment), class = c("gg",
       "ggplot"))
7: ggplot.data.frame(df, aes(x = gp, y = y))
6: ggplot(df, aes(x = gp, y = y)) at Rex1f9076ce76f7#19
5: eval(expr, envir, enclos)
4: eval(ei, envir)
3: withVisible(eval(ei, envir))
2: source(tf, local, echo = echo, prompt.echo = paste0(prompt.prefix,
       getOption("prompt")), continue.echo = paste0(prompt.prefix,
       getOption("continue")), verbose = verbose, max.deparse.length = Inf,
       encoding = "UTF-8", skip.echo = skips, keep.source = TRUE)
1: example(ggplot)

> sessionInfo()
R Under development (unstable) (2012-11-01 r61067)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base
other attached packages:
[1] plyr_1.7.1      ggplot2_0.9.2.1
loaded via a namespace (and not attached):
 [1] colorspace_1.2-0   dichromat_1.2-4    digest_0.5.2       grid_2.16.0
 [5] gtable_0.1.1       labeling_0.1       MASS_7.3-22        memoise_0.1
 [9] munsell_0.4        proto_0.3-9.2      RColorBrewer_1.0-5 reshape2_1.2.1
[13] scales_0.2.2       stringr_0.6.1      tools_2.16.0

/Henrik

Henrik Bengtsson

unread,
Nov 5, 2012, 10:51:17 PM11/5/12
to ggp...@googlegroups.com
This is still a problem with R Under development (unstable)
(2012-11-04 r61084) on Windows.

/Henrik
> --
> You received this message because you are subscribed to the ggplot2 mailing
> list.
> Please provide a reproducible example:
> https://github.com/hadley/devtools/wiki/Reproducibility
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2

Henrik Bengtsson

unread,
Nov 13, 2012, 7:53:48 PM11/13/12
to ggp...@googlegroups.com
Still the same with 'R Under development (unstable) (2012-11-12 r61105)'.

Hadley, can you confirm you're are aware of this?  If I don't back from you, I'll re-post on r-devel instead.

/Henrik

Ben Bolker

unread,
Nov 20, 2012, 9:27:56 PM11/20/12
to ggp...@googlegroups.com
 I've just been bitten by this: R Under development (unstable) (2012-11-20 r61133) with the testthat package.

  Henrik, I looked for discussion on r-devel and couldn't find it.  Did I miss it?  Any ideas/workarounds?

(Unfortunately I haven't come up with a small reproducible example yet ... trying to isolate the particular
issue that triggers the problem ...)

  thanks
    Ben Bolker

Ben Bolker

unread,
Nov 20, 2012, 9:30:53 PM11/20/12
to ggp...@googlegroups.com

  Oops, sorry, false alarm.  The error wasn't testthat's fault, it was really coming from the package I was testing.

Ben Bolker

unread,
Nov 22, 2012, 12:54:03 PM11/22/12
to ggp...@googlegroups.com
  Henrik, I hit this again.  Re-installing the scales package solved the problem (for me).

  Ben



On Tuesday, November 13, 2012 7:53:48 PM UTC-5, Henrik Bengtsson wrote:

Henrik Bengtsson

unread,
Nov 21, 2012, 7:25:25 PM11/21/12
to Ben Bolker, ggp...@googlegroups.com
Hi.

On Tue, Nov 20, 2012 at 6:27 PM, Ben Bolker <bbo...@gmail.com> wrote:
> I've just been bitten by this: R Under development (unstable) (2012-11-20
> r61133) with the testthat package.
>
> Henrik, I looked for discussion on r-devel and couldn't find it. Did I
> miss it? Any ideas/workarounds?

No, I haven't posted to R-devel yet. No ideas for workarounds. Just
don't have the time to troubleshoot. However, I just got what looks
like a related error when in a non-ggplot2 case, so I guess I'll post
to R-devel next;

% R --vanilla
> library(Rsamtools)
> example(BamFile)

BamFil> fl <- system.file("extdata", "ex1.bam", package="Rsamtools",
BamFil+ mustWork=TRUE)

BamFil> length(scanBam(fl)[[1]][[1]]) # all records
Error in g$new : object of type 'closure' is not subsettable

> sessionInfo()
R Under development (unstable) (2012-11-17 r61127)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] parallel stats graphics grDevices utils datasets methods
[8] base

other attached packages:
[1] Rsamtools_1.11.6 Biostrings_2.27.6 GenomicRanges_1.11.9
[4] IRanges_1.17.10 BiocGenerics_0.5.1

loaded via a namespace (and not attached):
[1] bitops_1.0-5 stats4_2.16.0 tools_2.16.0 zlibbioc_1.5.0


/Henrik

Henrik Bengtsson

unread,
Nov 23, 2012, 7:36:52 PM11/23/12
to Ben Bolker, ggp...@googlegroups.com
On Thu, Nov 22, 2012 at 9:54 AM, Ben Bolker <bbo...@gmail.com> wrote:
> Henrik, I hit this again. Re-installing the scales package solved the
> problem (for me).

Unfortunately not a general solution. In a vanilla/fresh R-devel
session, I did:

install.packages("scales", type="source");

and confirmed by:

> packageDescription("scales")
Package: scales
Type: Package
Title: Scale functions for graphics.
Version: 0.2.2
[...]
Packaged: 2012-09-03 20:29:10 UTC; winston
Repository: CRAN
Date/Publication: 2012-09-04 06:16:24
Built: R 2.16.0; ; 2012-11-24 00:32:31 UTC; windows

but still gets (in a fresh R session):

> library("ggplot2")
> example(ggplot)

ggplot> df <- data.frame(gp = factor(rep(letters[1:3], each = 10)),
ggplot+ y = rnorm(30))

ggplot> # Compute sample mean and standard deviation in each group
ggplot> library(plyr)

ggplot> ds <- ddply(df, .(gp), summarise, mean = mean(y), sd = sd(y))

ggplot> # Declare the data frame and common aesthetics.
ggplot> # The summary data frame ds is used to plot
ggplot> # larger red points in a second geom_point() layer.
ggplot> # If the data = argument is not specified, it uses the
ggplot> # declared data frame from ggplot(); ditto for the aesthetics.
ggplot> ggplot(df, aes(x = gp, y = y)) +
ggplot+ geom_point() +
ggplot+ geom_point(data = ds, aes(y = mean),
ggplot+ colour = 'red', size = 3)
Error in eval(expr, envir, enclos) :
no slot of name "generator" for this object of class "refObjectGenerator"

/Henrik

Henrik Bengtsson

unread,
Nov 23, 2012, 9:58:07 PM11/23/12
to Ben Bolker, ggp...@googlegroups.com
[ I knew it was going to come, and it did offline... ;) ]

So, I after reinstalling *ggplot2* as well, it all works. Problem
solved! So, I summary I did:

1. install.packages("scales", type="source") # Still not working
2. install.packages("ggplot2", type="source") # Solved the problem

It's interesting to note that when the sessionInfo():s are identical
before and after the above steps. I also tried to install the CRAN
binary [which has a file timestamp of Nov 22, cf.
http://cran.r-project.org/bin/windows/contrib/r-devel/] and it still
works, so it may be enough to just do:

1. install.packages("ggplot2")

/Henrik

Winston Chang

unread,
Nov 28, 2012, 3:58:34 PM11/28/12
to Henrik Bengtsson, Ben Bolker, ggplot2
I just want to check in about this. Reinstalling ggplot2 from source fixed the problem?

Thanks,
-Winston

Ben Bolker

unread,
Nov 28, 2012, 4:46:13 PM11/28/12
to Winston Chang, Henrik Bengtsson, ggplot2
On 12-11-28 03:58 PM, Winston Chang wrote:
> I just want to check in about this. Reinstalling ggplot2 from source
> fixed the problem?
>
> Thanks,
> -Winston

For me, yes.
> <mailto:ggp...@googlegroups.com>
> >> To unsubscribe: email ggplot2+u...@googlegroups.com
> <mailto:ggplot2%2Bunsu...@googlegroups.com>
> >> More options: http://groups.google.com/group/ggplot2
>
> --
> You received this message because you are subscribed to the ggplot2
> mailing list.
> Please provide a reproducible example:
> https://github.com/hadley/devtools/wiki/Reproducibility
>
> To post: email ggp...@googlegroups.com
> <mailto:ggp...@googlegroups.com>
> To unsubscribe: email ggplot2+u...@googlegroups.com
> <mailto:ggplot2%2Bunsu...@googlegroups.com>
> More options: http://groups.google.com/group/ggplot2
>
>

Reply all
Reply to author
Forward
0 new messages