Learn R Programming

beadplexr (version 0.5.0)

pad_matrix: Pad a matrix

Description

Pad a matrix

Usage

pad_matrix(x, pad_size = 1L, pad = 0L)

Value

A matrix

Arguments

x

The matrix to pad.

pad_size

An integer giving the number of columns/rows to pad with.

pad

A single value giving the padding.

Examples

Run this code

x <- matrix(c(1:9), nrow = 3, ncol = 3)
beadplexr:::pad_matrix(x)

x <- matrix(c(1:4), nrow = 2, ncol = 2)
beadplexr:::pad_matrix(x)
beadplexr:::pad_matrix(x, pad_size = 2L)
beadplexr:::pad_matrix(x, pad = NA)
beadplexr:::pad_matrix(x, pad = "xx")

x <- matrix(c(1:6), nrow = 3, ncol = 2)
beadplexr:::pad_matrix(x)

Run the code above in your browser using DataLab