Description Usage Arguments Value Author(s) See Also Examples
View source: R/smartRbindMat.R
Row bind matrices whose column names may not be the same
1 | smartRbindMat(..., distinguish = FALSE, filler = NA)
|
... |
matrix objects (separated by commas), a list of matrices, or a character vector containing the names of matrix objects |
distinguish |
if |
filler |
The character to insert into the final matrix for those empty elements which occur when not all the matrices have the same column names. |
Produces a matrix with a union of the column names. Empty elements
resulting from different column names are set to the value of
filler
.
Landon Sego
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | x <- matrix(rnorm(6), ncol = 2, dimnames = list(letters[1:3],letters[4:5]))
y <- matrix(rnorm(6), ncol = 3, dimnames = list(letters[7:8],letters[4:6]))
z <- matrix(rnorm(2), nrow = 1, dimnames = list("c",letters[3:4]))
x
y
z
smartRbindMat(x,y,z)
smartRbindMat(list(x, y, z), distinguish = TRUE)
smartRbindMat(y,z,x, distinguish = TRUE)
smartRbindMat(c("y","x","z"), filler = -20, distinguish = TRUE)
w1 <- matrix(sample(letters[1:26], 6), ncol = 2,
dimnames = list(c("3", "", "4"), c("w", "v")))
x1 <- matrix(sample(letters[1:26], 6), ncol = 2,
dimnames = list(NULL, letters[4:5]))
y1 <- matrix(sample(letters[1:26], 6), ncol = 3,
dimnames = list(NULL, letters[4:6]))
z1 <- matrix(sample(letters[1:26], 2), nrow = 1,
dimnames = list(NULL, letters[3:4]))
w1
x1
y1
z1
smartRbindMat(w1,x1,y1,z1)
smartRbindMat(list(w1 = w1, x1 = x1, y1 = y1, z1 = z1), distinguish = TRUE)
smartRbindMat(w1,x1,y,z1,z)
smartRbindMat(w1,x1,y,z1,z, distinguish = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.