Re: [R] g(x,y) = f(x,y) - e(x)- e(y)?

From: hadley wickham <>
Date: Wed, 23 Apr 2008 09:35:27 -0500

> Thanks Phipp very much for your help. I had meant, given that I'd

> computed the matrix f[x,y] and the vector e[x], how to take the
> difference. What is confusing is how to subtract a vector from a
> matrix. I don't want the recycling rule.

That function sounds like its describing how to subtract the vector from the matrix:

g[1, 1] = f[1, 1] - e[1] - e[1]
g[2, 3] = f[2, 3] - e[2] - e[3]

(which implies that f is square)

So maybe something like:

g <- f - outer(e, e, "-")

But a link to the paper and an example would be very helpful!



______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 23 Apr 2008 - 14:58:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 23 Apr 2008 - 16:30:32 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive