[R] Embedding lists in matrices and matrices in lists
Michael Kogan
michael.kogan at gmx.net
Tue Aug 18 10:48:10 CEST 2009
Hi,
I'm new to programming, new to R and even new to mailing lists so please
be patient with me. I need to manage many matrices generated by an R
program. These matrices have different dimensions and I'd like to group
them somehow. The best way would be to have a big matrix (let's call it
database) where every element database[x,y] consists of a list of
matrices that all have the dimensions ncol(matrix1)=x and
nrow(matrix1)=y. So those matrices have to be embedded into lists and
the lists have to be embedded in the big database matrix. If I simply try
database=matrix(0,10,10)
database[4,4]=c(matrix1,matrix2)
I get
Error in database[4, 4] = c(matrix1, matrix2) :
number of items to replace is not a multiple of replacement length
Execution halted
which makes sense of course... Is there any possibility to make this
work? Or maybe there is a better way to organize those matrices?
Regards,
Michael
More information about the R-help
mailing list