Skip to content
Prev 156832 / 398506 Next

how to set rownames / colnames for matrices in a list

Thanks for the hint with the "dimnames". I found a rather similar problem in 
the mailing list solved like this:

x <- matrix(1:4,2)
y <- matrix(5:8,2)

z <- list(x,y)
nm <- c("a","b")
nms <- list(nm,nm)

z <- lapply(z,function(x){
     dimnames(x)<-nms
     x
})

Is there anything wrong using a list instead of an array???

Antje



Alain Guillet schrieb: