dat <- darwin.maize
# Compare self-pollination with cross-pollination
require("lattice")
bwplot(height~type, dat)
require("reshape2")
dm <- melt(dat)
d2 <- dcast(dm, pot+pair~type)
d2$diff <- d2$cross-d2$self
t.test(d2$diff)Run the code above in your browser using DataLab