Java Mailing List Archive

http://www.r-help.com/

Home » R Help for Statistical Computing »

Re: [R] sum of list elements

Richard M. Heiberger

2009-07-02

Replies: Find Java Web Hosting

Author LoginPost Reply
I think you are asking for Reduce

> Reduce(`+`, a)
   [,1] [,2] [,3]
[1,]   3   0   0
[2,]   0   3   0
[3,]   0   0   3
>

You might be asking for do.call with some function's name as its first
argument.

> do.call("sum", a)
[1] 9
>

______________________________________________
R-help@(protected)
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
©2008 r-help.com - Jax Systems, LLC, U.S.A.