Learn R Programming

ramify (version 0.3.3)

repmat: Repeat Vectors and Matrices

Description

Repeat a vector or matrix a specific number of times.

Usage

repmat(x, m, n)

Arguments

x
A vector or matrix.
m
Integer specifying how many times to repeat x in the first dimension.
n
Integer specifying how many times to repeat x in the second dimension.

Value

A block matrix of dimension m*nrow(x) by n*ncol(x).

Examples

Run this code
repmat(1:3, 3, 2)  # will have dimension 9 by 2
repmat(randn(2, 2), 3, 2)

Run the code above in your browser using DataLab