[R] Element-by-element multiplication operator?

Peter Dalgaard p.dalgaard at biostat.ku.dk
Wed Nov 9 21:23:46 CET 2005


"Gates, Michael BGI SF" <Michael.Gates at barclaysglobal.com> writes:

> 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...

It's * , plain and simple. The _other_ one is %*%.
 
> Thanks
> 
> -Mike Gates
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907




More information about the R-help mailing list