From: <markleeds_at_verizon.net>

Date: Wed 28 Jun 2006 - 12:12:57 EST

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jun 28 12:20:04 2006

Date: Wed 28 Jun 2006 - 12:12:57 EST

Marc and many other people ( whose names escape me ) have been
very helpful in explaining the use of lapply to me.

lapply(tradevectors,function(x) G[x]*B[x] )

This is fine and I understand it.

Attempt 1 : lapply(tradevectors,function(i) myfunction(G[i],B[i])

Attempt 2 : lapply(along=tradevectors),function(i) myfunction(G[[i]],B[[i]]

In attempt1, I am just putting tradevectors and indexing using the [] which I think won't work. In attemp t2, I am using along=tradevectors and using [[]].

I think # 2 is correct but could someone confirm this because I have quite large vectors and it's not easy at all for me to check what's going on and I'm not so clear with lapply usage. There's seem tobe many different ways of setting up the first parameter in the call to lapply.

Thanks ______________________________________________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 Received on Wed Jun 28 12:20:04 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 Wed 28 Jun 2006 - 18:12:34 EST.

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