Learn R Programming

ISOpureR (version 1.1.3)

ISOpure.util.repmat: Tiles matrix horizontally or vertically

Description

Tiles matrix horizontally or vertically in the same way as the Matlab repmat command

Usage

ISOpure.util.repmat(a, n, m)

Arguments

a

A matrix

n

Number of times the matrix should be tiled horizontally

m

number of times the matrix should be tiled vertically

Value

A matrix which has replicated and tiled the input matrix a by n rows and m columns

Examples

Run this code
# NOT RUN {
x <- matrix(runif(6), 3, 2)
x
#           [,1]      [,2]
# [1,] 0.5167029 0.7543404
# [2,] 0.9064936 0.4316977
# [3,] 0.3256870 0.5310625
ISOpure.util.repmat(x, 1, 2)
#           [,1]      [,2]      [,3]      [,4]
# [1,] 0.5167029 0.7543404 0.5167029 0.7543404
# [2,] 0.9064936 0.4316977 0.9064936 0.4316977
# [3,] 0.3256870 0.5310625 0.3256870 0.5310625
ISOpure.util.repmat(x, 2, 1)
#           [,1]      [,2]
# [1,] 0.5167029 0.7543404
# [2,] 0.9064936 0.4316977
# [3,] 0.3256870 0.5310625
# [4,] 0.5167029 0.7543404
# [5,] 0.9064936 0.4316977
# [6,] 0.3256870 0.5310625
ISOpure.util.repmat(x, 2, 3)
#           [,1]      [,2]      [,3]      [,4]      [,5]      [,6]
# [1,] 0.5167029 0.7543404 0.5167029 0.7543404 0.5167029 0.7543404
# [2,] 0.9064936 0.4316977 0.9064936 0.4316977 0.9064936 0.4316977
# [3,] 0.3256870 0.5310625 0.3256870 0.5310625 0.3256870 0.5310625
# [4,] 0.5167029 0.7543404 0.5167029 0.7543404 0.5167029 0.7543404
# [5,] 0.9064936 0.4316977 0.9064936 0.4316977 0.9064936 0.4316977
# [6,] 0.3256870 0.5310625 0.3256870 0.5310625 0.3256870 0.5310625
# }

Run the code above in your browser using DataLab