-4

Just a quick background:

I did a study on the effect of vocal music in teaching English. The study had 40 participants including male and female students. it consisted of a control and experimental group. the latter went through a treatment process while the former did not. before the treatment I did a pretest on the subjects to make sure of the homogeneity of the participant's knowledge of English and after the treatment I did a post test to see whether or not the said treatment has had an effect. What I want to do now is to create a bar graph using R in which the Y axis shows the calculated mean score of the post-test and the X axis the gender.

here's what I did and it did not work:

qplot(x = gender, y=mean(Project$posttest_score, data=Project) +geom_bar(stat="identity")
zx8754
  • 52,746
  • 12
  • 114
  • 209
  • Welcome to Stack Overflow! Please read the info about [how to ask a good question](http://stackoverflow.com/help/how-to-ask) and how to give a [reproducible example](http://stackoverflow.com/questions/5963269). This will make it much easier for others to help you. – zx8754 Jul 31 '16 at 20:46
  • Ditto what @zx8754 said; but there also appears to be a typo in your code. Should `data=Project` be outside of `mean(...)`? – Weihuang Wong Jul 31 '16 at 20:58
  • Thanks, I'll make sure to give it a good read! – Maziar Pedrami Aug 01 '16 at 09:01

1 Answers1

1

Like this?

ggplot(data=Project, aes(y=posttest_score,x=gender)) + 
stat_summary(fun.y = "mean", geom = "bar")
Dambo
  • 3,318
  • 5
  • 30
  • 79