Teeth <- caries$after - caries$before
anova <- aov(Teeth~inst * treat, data=caries)
summary(anova)
ggplot(data = caries, aes(x=inst, y=Teeth, group=inst)) +
geom_boxplot(colour = "black", fill = "dodgerblue")
This is my code so far - caries is the imported data set.
I am trying to make the three different boxes different colors, and right now they are only in dodger blue.
Data
caries <- structure(list(subject = 1:69, inst = c(1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L),
before = c(7L, 20L, 21L, 1L, 3L, 20L, 9L, 2L, 11L, 15L, 7L,
17L, 9L, 1L, 3L, 10L, 13L, 3L, 4L, 4L, 15L, 6L, 4L, 18L,
11L, 9L, 4L, 5L, 11L, 4L, 4L, 7L, 0L, 3L, 0L, 8L, 2L, 13L,
9L, 15L, 13L, 2L, 9L, 4L, 10L, 7L, 14L, 7L, 3L, 9L, 8L, 19L,
10L, 10L, 7L, 13L, 5L, 1L, 8L, 4L, 4L, 14L, 8L, 3L, 11L,
16L, 8L, 0L, 3L), after = c(11L, 24L, 25L, 2L, 7L, 23L, 13L,
4L, 13L, 18L, 10L, 17L, 11L, 5L, 7L, 14L, 17L, 4L, 7L, 9L,
18L, 8L, 6L, 19L, 12L, 9L, 7L, 7L, 14L, 6L, 4L, 7L, 4L, 3L,
1L, 8L, 4L, 18L, 12L, 18L, 17L, 5L, 12L, 6L, 14L, 11L, 15L,
10L, 6L, 12L, 10L, 19L, 13L, 12L, 11L, 12L, 8L, 3L, 9L, 5L,
7L, 14L, 10L, 5L, 12L, 18L, 8L, 1L, 4L), treat = structure(c(3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 3L,
3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L,
1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("APF", "SF",
"W"), class = "factor")), .Names = c("subject", "inst", "before",
"after", "treat"), class = "data.frame", row.names = c(NA, -69L
))