Or ... if you mean "simpler" as in "less to type", you can define your own 
binary operator by enclosing it in "%" signs, and the assign any of the 
previously proposed solutions, e.g.

y = matrix(cbind(c(0, 0.5, 1),c(0, 0.5, 1)),ncol=2)
z = matrix(c(12, -6),ncol=2)
'%.*%' <- function(a,b) {a * rep(b, each=3)}


y %.*% z


     [,1] [,2]
[1,]    0    0
[2,]    6   -3
[3,]   12   -6

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to