Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stat_summary fun.data #929

Closed
bholt opened this issue Mar 6, 2014 · 2 comments
Closed

stat_summary fun.data #929

bholt opened this issue Mar 6, 2014 · 2 comments
Milestone

Comments

@bholt
Copy link

bholt commented Mar 6, 2014

I'm confused about how stat_summary is supposed to work. The documentation claims that a data frame is passed as input, and it's expected to return a data frame. However, when I write my own and print the contents of the input parameter, I get just the y vector:

test <- function(y) { print(y) }
ggplot(...)+stat_summary(fun.data=test, geom="text")

This made more sense when I looked here: https://github.com/hadley/ggplot2/blob/master/R/stat-summary.r#L128 and saw that it was just passing df$y.

Am I missing something? What is the correct way to use fun.data?

Thanks.

@hadley
Copy link
Member

hadley commented Apr 22, 2014

I think the documentation is wrong - the function only gets a single vector, but it can return a data frame.

@hadley hadley added the docs label Apr 22, 2014
@hadley hadley added this to the v1.0.0 milestone Apr 22, 2014
@hadley hadley closed this as completed in 1cdf233 Apr 23, 2014
@bholt
Copy link
Author

bholt commented Apr 23, 2014

Okay thanks for the clarification. It would be more useful (for my use case) to receive the full data frame. But perhaps a new interface that doesn't break existing uses.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants