[R] summing elements in a list of functions

James Foadi jf117 at york.ac.uk
Fri Oct 20 17:14:55 CEST 2006


Many thanks to those who have answered my question.
Could I ask Gabor and Peter the meaning of:

> sum(sapply(ttt,function(f) f(x)))

I gather that a "mysterious" function f(x) is applied to all components of 
ttt, and sum can act on this modified object. But what is exactly f? And how 
does the list object change?

Cheers,

J

-- 
Dr James Foadi
Department of Physics
University of York
York YO10 5DD

email: jf117 at york.ac.uk
web page: http://www-users.york.ac.uk/~jf117
Tel: 0044 1904 434622
Mobile: 0044 7740 678548



More information about the R-help mailing list