I would like to divide each row of a matrix by a fixed vector. For example
mat<-matrix(1,ncol=2,nrow=2,TRUE)
dev<-c(5,10)
Giving mat/dev divides each column by dev.
[,1] [,2]
[1,] 0.2 0.2
[2,] 0.1 0.1
However, I would like to have this as a result, i.e. do the operation row-wise :
rbind(mat[1,]/dev, mat[2,]/dev)
[,1] [,2]
[1,] 0.2 0.1
[2,] 0.2 0.1
Is there an explicit command to get there?