Possible Duplicate:
Create a bar graph with pre-summarized data using ggplot2
On ggplot2 reference manual
http://had.co.nz/ggplot2/geom_bar.html
We can see that stacked bar charts are quite easy using the provided diamond data.
However, the dataset I am trying to use is different from the diamond data because mine is already summarized.
Attached is a minimal example of what I mean
AgeGroup gender Level.of.Education status count
1 18-25 male High School married 10
2 18-25 male High School single 20
3 18-25 male College married 25
4 18-25 male College single 10
5 18-25 male PhD married 50
6 18-25 male PhD single 4
7 18-25 male GED married 20
8 18-25 male GED single 100
9 18-25 female High School married 20
10 18-25 female High School single 10
11 18-25 female College married 30
12 18-25 female College single 60
13 18-25 female PhD married 80
14 18-25 female PhD single 10
15 18-25 female GED married 5
16 18-25 female GED single 2
Full dataset has timeframe as well so what I want to produce is a stacked bar graph showing number of married people and unmarried people overtime using “level of education” as fill on the bar.
Full dataset is so large that aggregate data like this is highly desired.
Your input would greatly help me. Thanks.
you need
stat='identity'.I’d also suggest faceting by gender: