Skip to content
Prev 58353 / 398502 Next

make apply() return a list

Hi,

thank you very much Sundar, Patrick, Tony, Mahub and Gabor for your helpful 
answers! All your examples work great. They are all more straightforeward 
than my example and much faster than the for-loop. 
These are the average elapsed times (in seconds) returned by system.time()[3] 
(applied to my real function and my real data):

my original for-loop: 
5.55 

the example I presented in my previous email (using apply):
2.35 

example suggested by Tony (using apply):
2.34 

example suggested by Gabor (using lapply):
2.50 

examples suggested by Sundar and Mahub (using lapply):
2.68 

Best regards,
Arne
On Monday 01 November 2004 19:52, Sundar Dorai-Raj wrote: