[R] Equivalent to matlab ".*" operator in R

Ruima E. ruimaximo at gmail.com
Wed Nov 19 15:22:24 CET 2014


Hi,

I have this:

y = matrix(cbind(c(0, 0.5, 1),c(0, 0.5, 1)),ncol=2)
z = matrix(c(12, -6),ncol=2)

In matlab I would do this

> y .* x

I would get this in matlab

> ans
0    -0
6    -3
12   -6

What is the equivalent in R?

Thanks

	[[alternative HTML version deleted]]



More information about the R-help mailing list