Learn R Programming

sdetorus (version 0.1.10)

repRow: Replication of rows and columns

Description

Wrapper for replicating a matrix/vector by rows or columns.

Usage

repRow(x, n)

repCol(x, n)

Value

A matrix of dimension c(nr * n, nc) for repRow or c(nr, nc * n) for repCol.

Arguments

x

a numerical vector or matrix of dimension c(nr, nc).

n

the number of replicates of x by rows or columns.

Examples

Run this code
repRow(1:5, 2)
repCol(1:5, 2)
A <- rbind(1:5, 5:1)
A
repRow(A, 2)
repCol(A, 2)

Run the code above in your browser using DataLab