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

1
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

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.

Value

a character matrix

Author(s)

Max Kuhn

Examples

1
2
3
4
5
6
7
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"))