Displaying 1 result from an estimated 1 matches for "oday".
Did you mean:
day
2003 Dec 04
1
assigning colors to barplot when beside=TRUE
...0 1 3 7
a B NA 3
b B NA 4
pigs <- read.table("~/pigs.dat", h=TRUE)
attach(pigs)
tbl <- tapply(gain, list(type=="B", pig), I) # generate matrix
o1 <- rev(order(tbl[1, 1:3])) # sort order for group 1
oB <- rev(order(tbl[1, 4:5]))+3 # ditto, group B
oday <- day[match(levels(pig), pig)] # day of sacrifice ordered as pig/tbl
colv <- match(oday, c(1, 3))+1
barplot(tbl[,c(o1, oB)], beside=TRUE, ylim=c(0,8), xlab="pig",
ylab="weight gain (g)", col=colv)
legend(12, 8, fill=c(2:3,NA), legend=c(paste("day&...