At 01:39 pm -0500 31/03/04, Raubertas, Richard wrote:
Another alternative is to use the underappreciated function
'sweep()':
sweep(A, 1:2, a, +)
I find the following helpful (it's not due to me but I cannot find
the original poster):
%.+% - function(a,x){sweep(a , 2:1 , x ,+ )}
%+.% -
:00 AM
To: Tamas Papp
Cc: R-help mailing list
Subject: Re: [R] array addition doesn't recycle!
The recycling rules are documented and this is not amongst them.
Computer packages do have a tendency to follow their rules
rather than
read your mind.
I suspect A + as.vector(a) is what