dummy <- data.frame(values = rnorm(30), fac1 = factor(rep(rep(1:3, each
= 5), 2)), fac2 = factor(rep(1:2, each = 15) ))
p <- ggplot(dummy, aes(fac1, values)) + geom_boxplot() + facet_wrap(~
fac2)
p
Many thanks
Etienne
# previous code
dummy <- data.frame(values = rnorm(30), fac1 = factor(rep(rep(1:3, each
= 5), 2)), fac2 = factor(rep(1:2, each = 15) ))
p <- ggplot(dummy, aes(fac1, values)) + geom_boxplot() + facet_wrap(~
fac2)
p
# solution: add letters for post-hoc Tukey results above upper whiskers
lettpos <- function(dummy) boxplot(dummy$values)$stats[5,]
test <- ddply(dummy, .(fac2, fac1), lettpos)
test$lett <- rep("a", nrow(test))
colnames(test)[3] <- "upper"
p + geom_text(aes(fac1, upper + 0.05, label = lett), data = test, vjust
= 0)
--
Etienne Laliberté
================================
School of Forestry
University of Canterbury
Private Bag 4800
Christchurch 8140, New Zealand
Phone: +64 3 366 7001 ext. 8365
Fax: +64 3 364 2124
www.elaliberte.info
--Brian Diggs
On Mar 30, 7:29 pm, Etienne Laliberté <etiennelalibe...@gmail.com>
wrote:
Cheers
Etienne