Hello group-members!
I want to compare 10 means of different groups in one output. I
realised it with a combination of stat_summary() and facet_wrap
without big problems:
p <- qplot("Means", value, data=dataset, geom="bar", stat="summary",
fun.y = "mean") + facet_wrap(~ variable, ncol = 5)
But now I wanted to add the values of the 10 different means on top of
the bars.
q <- qplot("Means", value, data=dataset, geom=c("bar", "text"),
stat="summary", fun.y = "mean", label="?") + facet_wrap(~ variable,
ncol = 5)
On top of every bar you see the ? but I to put the values of the means
there. Has anyone a hint for me, how to realise this?
I tried the following ways without success:
r1 <- qplot("Means", value, data=dataset, geom=c("bar", "text"),
stat="summary", fun.y = "mean", label=c
("5","65","39","4","1","0","1","36","42","3")) + facet_wrap(~
variable, ncol = 5)
result: error = "geom_text requires the following missing aesthetics:
label")
r2 <- qplot("Means", value, data=dataset, geom=c("bar", "text"),
stat="summary", fun.y = "mean", label=mean(value)) + facet_wrap(~
variable, ncol = 5)
result: the overall mean of value is set on every bar but not the one
of the 10 groups
How do I set the label that it works?
Torsten Stollen
---
University of Koblenz-Landau
Institute for Social Sciences
Department of Political Science
http://ipw.uni-landau.de