[R] sum of list elements

David Winsemius dwinsemius at comcast.net
Fri Jul 3 05:57:19 CEST 2009


On Jul 2, 2009, at 11:24 PM, David Winsemius wrote:

>
> On Jul 2, 2009, at 10:20 PM, Ivo Shterev wrote:
>
>> a = list(diag(3), diag(3), diag(3))
>
>
>
> a = list(diag(3), diag(3), diag(3))
> > sum(unlist(a))
> [1] 9

> Also:
 > sum(sapply(a,I))
[1] 9

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list