Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.GSO.4.10.10304231347080.1906-100000@quetelet.stat.ucla.edu>
Date: 2003-04-23T20:50:29Z
From: Roger D. Peng
Subject: sum
In-Reply-To: <3A822319EB35174CA3714066D590DCD5C4FA47@usrymx25.merck.com>

Yes, the definition of "binary operator" seems to have escaped me this
morning.  I was looking for something along the lines of Deepayan's
answer.

-roger
_______________________________
UCLA Department of Statistics
http://www.stat.ucla.edu/~rpeng

On Wed, 23 Apr 2003, Liaw, Andy wrote:

> Won't work if the list has more than 2 matrices.
> 
> Andy
> 
> > From: Roger Peng [mailto:rpeng at stat.ucla.edu]
> > 
> > How about something like:
> > 
> > > matlist <- list(matrix(1:16, 4, 4), matrix(2, 4, 4))
> > > do.call("+", matlist)
> >      [,1] [,2] [,3] [,4]
> > [1,]    3    7   11   15
> > [2,]    4    8   12   16
> > [3,]    5    9   13   17
> > [4,]    6   10   14   18
> > > 
> > 
> > -roger
> > _______________________________
> > UCLA Department of Statistics
> > http://www.stat.ucla.edu/~rpeng
> > 
> > On Wed, 23 Apr 2003, Luis Silva wrote:
> > 
> > > Dear helpers
> > > 
> > > I have a list where each element is a matrix (the list is 
> > > obtained with lapply). I want to sum those matrices. Is there a 
> > > function to do that? The sum function sums all the elements...
> > > --
> > > 
> > > 
> > > http://adsl.sapo.pt
> > > 
> > > ______________________________________________
> > > R-help at stat.math.ethz.ch mailing list
> > > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > >
> > 
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > 
> 
> ------------------------------------------------------------------------------
> Notice: This e-mail message, together with any attachments, cont... {{dropped}}
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>