Skip to content
Back to formatted view

Raw Message

Message-ID: <1294311405773-3177212.post@n4.nabble.com>
Date: 2011-01-06T10:56:45Z
From: emj83
Subject: How to join matrices of different row length from a list

Hi,

I have several matrix in a list, for example:
e
[[1]]
     [,1] [,2]
[1,]    1    3
[2,]    2    4

[[2]]
     [,1] [,2]
[1,]    1    4
[2,]    2    5
[3,]    3    6

[[3]]
     [,1] [,2]
[1,]    2    1

I would like to join them by column i.e.
     [,1] [,2]   [,3] [,4][,5] [,6]
[1,]    1    3   1    4    2    1
[2,]    2    4   2    5   NA  NA
[3,]   NA  NA  3    6   NA   NA

I have tried  do.call(cbind,e) but I get this error message as the rows are
of different length-
Error in function (..., deparse.level = 1)  :
  number of rows of matrices must match (see arg 2)

Can anyone advise me please?

Thanks Emma


-- 
View this message in context: http://r.789695.n4.nabble.com/How-to-join-matrices-of-different-row-length-from-a-list-tp3177212p3177212.html
Sent from the R help mailing list archive at Nabble.com.