[R] Element-by-element multiplication operator?

hadley wickham h.wickham at gmail.com
Wed Nov 9 21:06:37 CET 2005


> Is there an element-by-element multiplication in R, like the .* operator in Matlab?

How about *?

a <- matrix(1:4, 2, 2)
b <- matrix(4:7, 2, 2,)
a * b

Hadley




More information about the R-help mailing list