matrix_op | R Documentation |
Matrix operations based on matching dimensions
matrix_op(m1, m2, op = `+`)
m1 , m2 |
matrices with dimnames |
op |
the operation to be performed |
nms1 <- letters[1:4]
mat1 <- matrix(1:8, nrow=4, ncol=4, dimnames=list(nms1, nms1))
nms2 <- letters[2:3]
mat2 <- matrix(11:18, nrow=2, ncol=4, dimnames=list(nms2, nms1))
matrix_op(mat1, mat2)
matrix_op(mat1, mat2, `*`)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.