Create a big matrix by tiling given matrix m*n times in a rectangular grid. repmat resembles the matlab function of the same name.

repmat(x, m, n)

Arguments

x

a matrix

m

number of repetitions in dimension 1 (row multiply factor)

n

number of repetitions in dimension 2 (column multiply factor)

Value

A matrix of size '(m*r) x (n*c)', where 'r' ('c') represent the number of rows (columns) of 'x'.

Examples

x<-matrix(1:6,2) x
#> [,1] [,2] [,3] #> [1,] 1 3 5 #> [2,] 2 4 6
repmat(x,2,3)
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] #> [1,] 1 3 5 1 3 5 1 3 5 #> [2,] 2 4 6 2 4 6 2 4 6 #> [3,] 1 3 5 1 3 5 1 3 5 #> [4,] 2 4 6 2 4 6 2 4 6