Try this:
sum(sapply(l, '[[', 'b'))
On Tue, Aug 11, 2009 at 11:05 PM, R_help Help wrote:
> Hi,
>
> I have a list that contains about 100 elements. Each element contains
> the following matrix structure
>
> a b
> 1 1 4
> 2 2 5
> 3 3 6
>
> I'd like to sum column b across all elements. I'm thin
Hi,
I have a list that contains about 100 elements. Each element contains
the following matrix structure
a b
1 1 4
2 2 5
3 3 6
I'd like to sum column b across all elements. I'm thinking of using
lapply or sapply but cannot get it to work. Any help would be really
appreciated. Thank you.
adsch
2 matches
Mail list logo