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.
= 2 to stack vertically to create a (nr x n) x nc 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 )

[Package lazy.mat version 0.1.3 Index]