Since the stat_summary() examples in the current documentation
indicate the same error message, the safe thing to do in the interim
is probably to do the summarization outside of ggplot2 in a separate
data frame and then use it in the layers where you need it.
Here is an example for a simple interaction plot:
library(ggplot2)
library(plyr)
# Produce a data frame of mean(mpg) for vs/am combinations
mtm <- ddply(mtcars, .(vs, am), summarise, mn = mean(mpg))
# interaction plot
ggplot(mtm, aes(x = factor(vs), y = mn, group = factor(am))) +
geom_point(size = 3) + geom_line()
# The error message appears if I try something like this in 0.9.3:
ggplot(mtcars, aes(x = factor(vs), y = mpg) +
stat_summary(fun.y = mean, aes(group = factor(am)),
geom = "point", size = 3) +
stat_summary(fun.y = mean, aes(group = factor(am)),
geom = "line", size = 1)
The first stat_summary() call works, but not the second.
I looked around yesterday for open or closed issues on GitHub
regarding this topic, but didn't find one, so I don't know offhand if
this has been fixed in the development version or not.
Dennis
On Thu, Jan 10, 2013 at 12:05 AM, Morten Lindow <
morten...@gmail.com> wrote:
> I would be grateful if any would share a solution to this problem. Thanks!
>
> Morten
>