| Line 83... |
Line 83... |
| 83 |
with(ToothGrowth, {
|
83 |
with(ToothGrowth, {
|
| 84 |
boxplot(len ~ dose, boxwex = 0.25, at = 1:3 - 0.2,
|
84 |
boxplot(len ~ dose, boxwex = 0.25, at = 1:3 - 0.2,
|
| 85 |
subset = (supp == "VC"), col = "yellow",
|
85 |
subset = (supp == "VC"), col = "yellow",
|
| 86 |
main = "Guinea Pigs' Tooth Growth",
|
86 |
main = "Guinea Pigs' Tooth Growth",
|
| 87 |
xlab = "Vitamin C dose mg",
|
87 |
xlab = "Vitamin C dose mg",
|
| 88 |
ylab = "tooth length", ylim = c(0,35))
|
88 |
ylab = "tooth length", ylim = c(0, 35))
|
| 89 |
boxplot(len ~ dose, add = TRUE, boxwex = 0.25, at = 1:3 + 0.2,
|
89 |
boxplot(len ~ dose, add = TRUE, boxwex = 0.25, at = 1:3 + 0.2,
|
| 90 |
subset = supp == "OJ", col = "orange")
|
90 |
subset = supp == "OJ", col = "orange")
|
| 91 |
legend(2, 9, c("Ascorbic acid", "Orange juice"),
|
91 |
legend(2, 9, c("Ascorbic acid", "Orange juice"),
|
| 92 |
fill = c("yellow", "orange"))
|
92 |
fill = c("yellow", "orange"))
|
| 93 |
})
|
93 |
})
|
| Line 95... |
Line 95... |
| 95 |
# alternate form that avoids subset argument:
|
95 |
# alternate form that avoids subset argument:
|
| 96 |
with(subset(ToothGrowth, supp == "VC"),
|
96 |
with(subset(ToothGrowth, supp == "VC"),
|
| 97 |
boxplot(len ~ dose, boxwex = 0.25, at = 1:3 - 0.2,
|
97 |
boxplot(len ~ dose, boxwex = 0.25, at = 1:3 - 0.2,
|
| 98 |
col = "yellow", main = "Guinea Pigs' Tooth Growth",
|
98 |
col = "yellow", main = "Guinea Pigs' Tooth Growth",
|
| 99 |
xlab = "Vitamin C dose mg",
|
99 |
xlab = "Vitamin C dose mg",
|
| 100 |
ylab = "tooth length", ylim = c(0,35)))
|
100 |
ylab = "tooth length", ylim = c(0, 35)))
|
| 101 |
with(subset(ToothGrowth, supp == "OJ"),
|
101 |
with(subset(ToothGrowth, supp == "OJ"),
|
| 102 |
boxplot(len ~ dose, add = TRUE, boxwex = 0.25, at = 1:3 + 0.2,
|
102 |
boxplot(len ~ dose, add = TRUE, boxwex = 0.25, at = 1:3 + 0.2,
|
| 103 |
col = "orange"))
|
103 |
col = "orange"))
|
| 104 |
legend(2, 9, c("Ascorbic acid", "Orange juice"),
|
104 |
legend(2, 9, c("Ascorbic acid", "Orange juice"),
|
| 105 |
fill = c("yellow", "orange"))
|
105 |
fill = c("yellow", "orange"))
|