MAT_divide_rowwise | R Documentation |
The default use of / divides column-wise, but sometimes row-wise is needed. This function restores the dimnames.
MAT_divide_rowwise(data, divisor)
data |
(mat or df) Data to divide. |
divisor |
(num/int vectr) Divisor to use. |
Returns a data.frame/matrix with the orignal dimnames.
m = matrix(1:10, ncol=2)
m
m/c(1, 2) #divide column-wise
MAT_divide_rowwise(m, c(1, 2)) #row-wise
#works on data.frames too
MAT_divide_rowwise(iris[-5], c(1, 999, 1, 999)) %>% head
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.