Graphics Reference
In-Depth Information
Figure 5-3. Point shapes 16 and 19, as they appear with some bitmap output devices
Grouping Data Points by a Variable Using Shape or
Color
Problem
You want to group points by some variable, using shape or color.
Solution
Map the grouping variable to
shape
or
colour
. In the
heightweight
data set, there are many
columns, but we'll only use three of them in this example:
library(gcookbook)
# For the data set
# Show the three columns we'll use
heightweight[, c(
"sex"
,
"ageYear"
,
"heightIn"
)]
sex ageYear heightIn
f
11.92
56.3
f
12.92
62.3
f
12.75
63.3
...