Albert Y. Kim
Wednesday 2015/01/28
aes mappings of data variables to aesthetics we can perceive on a graphicgeom geometric objectsstat statistical transformations to summarise datafacet how to break up plots into subsetscoord coordinate system for x/y values: typically cartesian (can be polar)scale both convert data units to physical units the computer can display AND draw a legend/axes.?geom_line()ggplot2 book is on Moodle. To learn more, I suggest reading
The code for all examples in the book: http://ggplot2.org/book/
position adjustments: minor tweeks to the position of elementsWe build plots by adding layers. Each layer consists of:
Without all four elements specified, nothing will plot!
Notes:
geom has a default stat & position value if they aren't specifiedIn ggplot_2.R we have examples of
Examples of groups.Examples of geoms.geom_histogram() and position adjustments: Titanic Survival DataIn 1973, the UC Berkeley was sued for bias against women who had applied for admission to graduate schools. n=4526 applicants:
Source: local data frame [4 x 3]
Groups: Admit
Admit Gender Freq
1 Admitted Male 1198
2 Admitted Female 557
3 Rejected Male 1493
4 Rejected Female 1278
However, there was another variable researchers could consider: department applied to.
Source: local data frame [24 x 4]
Admit Gender Dept Freq
1 Admitted Male A 512
2 Rejected Male A 313
3 Admitted Female A 89
4 Rejected Female A 19
5 Admitted Male B 353
6 Rejected Male B 207
7 Admitted Female B 17
8 Rejected Female B 8
9 Admitted Male C 120
10 Rejected Male C 205
.. ... ... ... ...
Investigate: