repmat {lazy.mat} | R Documentation |
Stack a matrix n times either horizontally or vertically.
repmat(A, n, method = 2)
A |
Input matrix |
n |
number of times |
method |
= 1 to stack matices horizontally
to create a nr x (nc x n) matrix. |
When n is a scalar, the whole input is replicated n times.
When n is a vector of length nrow(A),
i-th row of A matrix will be replicated
n[i] times and verticall stacked.
When the input is a vector, the resul will also be a vector.
#'
Can be used with character matrix.
a matrix
repmat( demomat(2,2), 2 ) repmat( demomat(2,2), 2, method=1 ) repmat( demomat(2,2), 1:2 )