Kevin Ummel <kevinummel <at> gmail.com> writes:

> I'm looking for a way to 'explode' a matrix like this:
> 
> > matrix(1:4,2,2)
>      [,1] [,2]
> [1,]    1    3
> [2,]    2    4
> 


  This is the Kronecker product of your matrix with the
matrix  (1 1 ; 1 1)

m <- matrix(1:4,2,2)
kronecker(m,matrix(1,2,2))

  cheers
    Ben Bolker

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to