[R] g(x,y) = f(x,y) - e(x)- e(y)?
hadley wickham
h.wickham at gmail.com
Wed Apr 23 16:35:27 CEST 2008
> 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!
Hadley
--
http://had.co.nz/
More information about the R-help
mailing list