[R] Componentwise means of a list of matrices?

Duncan Murdoch murdoch at stats.uwo.ca
Tue Dec 30 19:39:13 CET 2008


On 30/12/2008 1:18 PM, Stavros Macrakis wrote:
> On Tue, Dec 30, 2008 at 12:53 PM, hadley wickham <h.wickham at gmail.com> wrote:
>> On Tue, Dec 30, 2008 at 10:21 AM, baptiste auguie <ba208 at exeter.ac.uk> wrote:
>>> I thought this was a good candidate for the plyr package, but it seems that
>>> l*ply functions are meant to operate only on separate list elements:...
>>>  Perhaps a new case to consider?
>> Possibly, but here I would argue that the choice of data structure
>> isn't quite right - if the matrices all have the same dimension, then
>> they should be stored in an array, not a list
> 
> That may be a reasonable representation, but I don't see why you'd
> want to require it.  In general, I'm not sure I understand the logical
> intuition behind the distinction between generic vectors (lists) and
> atomic vectors in many places in R (though of course I do understand
> that generic vectors have more *implementation* overhead for type
> tagging and garbage collection).

Could you give an example that you find unintuitive?  The obvious 
distinctions are that lists contain unlike things, while atomic vectors 
contain like things, and lists contain anything, while atomic vectors 
contain simple things, but I think you know both of those.

Duncan Murdoch



More information about the R-help mailing list