[R] Equivalent to matlab ".*" operator in R
toth.denes at ttk.mta.hu
Wed Nov 19 16:34:51 CET 2014
just for the records, your original code seems incorrect, see inline.
On 11/19/2014 03:22 PM, Ruima E. wrote:
> 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
Here you wrote 'x' which I guess refers to 'z', and should be repmat(z,
size(y, 1), 1) in matlab (assuming 'z' is a row vector)
> I would get this in matlab
> 0 -0
> 6 -3
> 12 -6
> What is the equivalent in R?
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help