[R] how to set rownames / colnames for matrices in a list

Antje niederlein-rstat at yahoo.de
Mon Sep 22 18:10:51 CEST 2008


Hello,

I have another stupid question. I hope you can give me a hint how to solve this:

I have a list and one element is again a list containing matrices, all of the 
same dimensions. Now, I'd like to set the dimnames for all matrices:

example code:

m1 <- matrix(1:25, nrow=5)
m2 <- matrix(26:50, nrow=5)
# ... there can be much more than two matrices

l <- list()
l[[1]] <- list(m1,m2)

r_names <- LETTERS[1:5]
c_names <- LETTERS[6:10]

? how can I apply these names to any number of matrices within this list-list ?

Ciao,
Antje



More information about the R-help mailing list