Re: [R] create block diagonal with each rows

2013-01-17 Thread arun
, 2013 12:18 PM Subject: Re: [R] create block diagonal with each rows >>>>> arun  >>>>>    on Wed, 16 Jan 2013 19:20:46 -0800 writes:     > Hi,     > May be this helps:     > library(Matrix)     > res1<-lapply(split(x,1:nrow(x)),function(y)

Re: [R] create block diagonal with each rows

2013-01-17 Thread Martin Maechler
may be more efficient to keep it !) you wrap the result with a as.matrix() --- Martin Maechler, ETH Zurich > - Original Message - > From: Kathryn Lord > To: r-help > Cc: > Sent: Wednesday, January 16, 2013 9:11 PM > Subject: [R

Re: [R] create block diagonal with each rows

2013-01-16 Thread arun
ent: Wednesday, January 16, 2013 9:11 PM Subject: [R] create block diagonal with each rows Dear R users, I'd like to create a block diagonal matrix with each rows in a matrix. Here is a simple example. (In fact, the matrix is big) x <- matrix(1:20, 4,5) > x     [,1] [,2] [,3] [,4] [,5]

Re: [R] create block diagonal with each rows

2013-01-16 Thread Andrew Robinson
Hi Kathryn, take a look at the kronecker function. Cheers Andrew On Thu, Jan 17, 2013 at 1:11 PM, Kathryn Lord wrote: > Dear R users, > > I'd like to create a block diagonal matrix with each rows in a matrix. > > Here is a simple example. (In fact, the matrix is big) > > > x <- matrix(1:20, 4