repmatrix: Extend a matrix by repetition of elements.

View source: R/matrix.R

repmatrixR Documentation

Extend a matrix by repetition of elements.

Description

Returns a new matrix, where the entries of the original matrix are repeated along both dimensions.

Usage

repmatrix(
  x,
  times = 1,
  each = 1,
  times.row = times,
  times.col = times,
  each.row = each,
  each.col = each,
  ...
)

Arguments

x

a matrix

times

how often the matrix should be replicated next to itself

each

how often individual cells should be replicated next to themselves

times.row

number of vertical repetitions of the matrix, overrides times

times.col

number of horizontal repetitions of the matrix, overrides times

each.row

number of vertical repetitions of individual elements, overrides each

each.col

number of horizontal repetitions of individual elements, overrides each

...

not used

Value

A matrix, which will have times*each times more rows and columns than the original matrix.

See Also

rep

Examples

repmatrix(diag(4))
repmatrix(diag(4), times=2)
repmatrix(diag(4), each=2)
repmatrix(diag(3), times=2, each=2)
repmatrix(diag(4), each.row=2)
repmatrix(diag(4), times.row=2)

kevinstadler/cultevo documentation built on Jan. 13, 2024, 11:22 p.m.