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