[R] Element-by-element multiplication operator?

Duncan Murdoch murdoch at stats.uwo.ca
Wed Nov 9 21:01:38 CET 2005


On 11/9/2005 2:26 PM, Gates, Michael BGI SF wrote:
> Is there an element-by-element multiplication in R, like the .* operator in Matlab?
> 
> eg: A (2x3)
>      B (2x3) 
> C=A.*B
> C (2x3)
> C = [[a11*b11  a12*b12  a13*b13]; [a21*b21  a22*b22  a23*b23]]
> 
> I can't find one...

Just use "*".  If you want matrix multiplication, you'd use %*%.

Duncan Murdoch




More information about the R-help mailing list