powered by
Expand a matrix with given rownames and colnames
expand_matrix(mat, rownames = NULL, colnames = NULL, fill = 0)
The matrix to expand
The desired rownames
The desired colnames
With what to fill missing data
x <- matrix(runif(12), ncol = 4, dimnames = list(c("a", "c", "d"), c("D", "F", "H", "I"))) expand_matrix(x, letters[1:5], LETTERS[1:10], fill = 0)
Run the code above in your browser using DataLab