odfWeave (version 0.8.4)

matrixPaste: Element-Wise Paste of Conforming Matrices

Description

For a series of character matrices with the same dimensions, paste each element together in the order specified.

Usage

matrixPaste(..., sep = rep(" ", length(list(...)) - 1))

Arguments

...
a set of P character matrices with the same dimensions
sep
a vector of P-1 separators for each element

Value

a character matrix

Details

The matrices are converted to vectors and pasted, then re-dimensioned. Different separators can be used between matrices, but the same separator must be used for all of the elements.

Examples

Run this code
mat1 <- matrix(letters[1:6], nrow = 2)
mat2 <- matrix(LETTERS[1:6], nrow = 2)
mat3 <- matrix(paste(1:6), nrow = 2)

matrixPaste(mat1, mat2)
matrixPaste(mat1, mat2, sep = "+")
matrixPaste(mat1, mat2, mat3, sep = c("+", "plus"))

Run the code above in your browser using DataLab