interleave {lazy.mat} | R Documentation |
Interleave the columns of Two Matrices
interleave(A, B, method = 1)
A |
First matrix |
B |
Second matrix |
If A=cbind(a1,a2,a3)
and B=cbind(b1,b2,b3,b4)
where a1, b1 etc are column vectors,
interleave(A,B)
will result in cbind(a1,b1,a2,b2,a3,b3,b4)
.
Column names will also be interleaved.
nr1 <- 4 nc1 <- 3 nr2 <- 4 nc2 <- 3 A1 <- demomat(nr1,nc1,rnroot="a",cnroot="a") A2 <- demomat(nr2,nc2,rnroot="b",cnroot="b") A1 <- 100*A1+1 A2 <- 100*A2+2 res <- interleave( A1,A2 ) Print(res)