RE: [R] array addition doesn't recycle!

2004-04-01 Thread Robin Hankin
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 ,"+" )} "%+.%"

RE: [R] array addition doesn't recycle!

2004-03-31 Thread Raubertas, Richard
] On Behalf Of Prof > Brian Ripley > Sent: Wednesday, March 31, 2004 10: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 packa

Re: [R] array addition doesn't recycle!

2004-03-31 Thread Prof Brian Ripley
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 you intended. On Wed, 31 Mar 2004, Tamas Papp wrote: > Hi, > > I have noticed the following: > > > a <- ar