repmat {lazy.mat} | R Documentation |
Stack a matrix n times either horizontally or vertically.
Description
Stack a matrix n times either horizontally or vertically.
Usage
repmat(A, n, method = 2)
Arguments
A |
Input matrix |
n |
number of times |
method |
= 1 to stack matices horizontally
to create a nr x (nc x n) matrix. |
Details
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.
Value
a matrix
Examples
repmat( demomat(2,2), 2 )
repmat( demomat(2,2), 2, method=1 )
repmat( demomat(2,2), 1:2 )
# Semi Symbolic Partitioned Matrix: Super Matrix with SMdim attributes
A=demomat(c(2,3),c(3,4),root="a")
Printb(A)
repA=repmat(A,2)
Printb(repA)
# with lazy.symbolic package
# trepA=tp(repA)
# Printb(trepA)
# Fully Symbolic Partitioned Matrix:
# No SMdim attribute but fullsymb attribute
Ap=demomat(2,3,root="A", fullsymb=1)
Printb(Ap)
repAp=repmat(Ap,2)
Printb(repAp)
# with lazy.symbolic package
# trepAp=tp(repAp)
# Printb(trepAp)
[Package lazy.mat version 0.1.6 ]