[R] Vector- matrix arithmatic

Laurent Gautier gautier at lion-ag.de
Tue Aug 31 14:40:11 CEST 1999

Peter Ho wrote:

> Hi,
> I have a matrix X of nrow=64 and ncol=5 and 2 vectors a and b both of length=5. I
> want to find
> the values for Y = a + (X-b) such that the operation of X is done by rows and not
> by columns.


Y _ a + ( t(X) - b )

It should do it...


PS : I wonder what kind of elegant solution the R-masters will give this time : I
particularly appreciated the dim(Z) _ NULL recently mentionned....

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list