if (FALSE) {
library(agridat)
data(australia.soybean)
dat <- australia.soybean
libs(reshape2)
dm <- melt(dat, id.var=c('env', 'year','loc','gen'))
# Joint plot of genotypes & traits. Similar to Figure 1 of Kroonenberg 1989
dmat <- acast(dm, gen~variable, fun=mean)
dmat <- scale(dmat)
biplot(princomp(dmat), main="australia.soybean trait x gen biplot", cex=.75)
# Figure 1 of Kozak 2010, lines 44-58
libs(reshape2, lattice, latticeExtra)
data(australia.soybean)
dat <- australia.soybean
dat <- melt(dat, id.var=c('env', 'year','loc','gen'))
dat <- acast(dat, gen~variable, fun=mean)
dat <- scale(dat)
dat <- as.data.frame(dat)[,c(2:6,1)]
dat$gen <- rownames(dat)
# data for the graphic by Kozak
dat2 <- dat[44:58,]
dat3 <- subset(dat2, is.element(gen, c("G48","G49","G50","G51")))
parallelplot( ~ dat3[,1:6]|dat3$gen, main="australia.soybean",
as.table=TRUE, horiz=FALSE) +
parallelplot( ~ dat2[,1:6], horiz=FALSE, col="gray80") +
parallelplot( ~ dat3[,1:6]|dat3$gen,
as.table=TRUE, horiz=FALSE, lwd=2)
}
Run the code above in your browser using DataLab