Re: [R] summing elements in a list of functions

From: James Foadi <jf117_at_york.ac.uk>
Date: Fri 20 Oct 2006 - 15:14:55 GMT

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@york.ac.uk
web page: http://www-users.york.ac.uk/~jf117
Tel: 0044 1904 434622
Mobile: 0044 7740 678548

______________________________________________
R-help@stat.math.ethz.ch mailing list
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.
Received on Sat Oct 21 05:01:26 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 20 Oct 2006 - 20:30:38 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.