stat_summary problem: argument 4 matches multiple formal arguments

2,348 views
Skip to first unread message

Jone Wy

unread,
Oct 9, 2009, 12:15:02 AM10/9/09
to ggplot2
Hi,
I tried the following functions with my own data and also with the
sample data of ggplot2.

stat_sum_df <- function(fun, geom="crossbar", ...) {
stat_summary(fun=fun, colour="red", geom=geom, width=0.2, ...)
}
stat_sum_single <- function(fun, geom="point", ...) {
stat_summary(fun=fun, colour="red", geom=geom, size = 3, ...)
}

The testing code:
c <- qplot(cyl, mpg, data=mtcars)
c+stat_sum_single(mean)
or
c + stat_sum_single(mean, geom="line")

But I always got the error message: "Error in get("calculate_groups",
env = .$stat, inherits = TRUE)(.$stat, : argument 4 matches multiple
formal arguments".

Any help? Thank you very much.

Dan

Eric Kostello

unread,
Oct 9, 2009, 12:26:50 PM10/9/09
to Jone Wy, ggplot2
Try changing your stat_summary arguments from "fun = ..." to "fun.y = ..."
This is what it shows in the current documentation, but I think it
used to work the way you have it below. That change worked for me.

Eric
Reply all
Reply to author
Forward
0 new messages