add_torows | R Documentation |
Fast addition of vector to each row of a matrix. This corresponds to t(t(x) + v)
add_torows(x, v)
x |
A matrix with dimensions n*k. |
v |
A vector of length k. |
A matrix of dimension n*k where v is added to each row of x
Claus Ekstrom <claus@rprimer.dk>
A <- matrix(1:12, ncol=3)
B <- c(1, 2, 3)
add_torows(A, B)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.