Skip to content
Prev 82485 / 398506 Next

operations on a list

you could try :

trt1 <- do.call("rbind", lapply(listexp, function(x) {
    zz <- aggregate(t(x), list(rep(1:3, each=2)), mean)[,-1]
    zz <- as.matrix(zz)
    sweep(zz[1:2,], 2, zz[3,], "-")[1,]}))

trt2 <- do.call("rbind", lapply(listexp, function(x) {
    zz <- aggregate(t(x), list(rep(1:3, each=2)), mean)[,-1]
    zz <- as.matrix(zz)
    sweep(zz[1:2,], 2, zz[3,], "-")[2,]}))

expeffect <- list(trt1=trt1, trt2=trt2)

expeffect <- lapply(expeffect, function(x) {names(x) <- names(listexp) ; x})




szhan at uoguelph.ca a ??crit :