But no one answered Kushan's question about performance implications of 
for-loop vs lapply.
With apologies to George Orwell:
"for-loops BAAAAAAD, no loops GOOOOOOD."

-----Original Message-----
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Uwe Ligges
Sent: Thursday, March 10, 2011 4:38 AM
To: Arun Kumar Saha
Cc: r-help@r-project.org
Subject: Re: [R] using lapply



On 10.03.2011 08:30, Arun Kumar Saha wrote:
> On reply to the post
> http://r.789695.n4.nabble.com/using-lapply-td3345268.html

Hmmm, can you please reply to the original post and quote it?
You mail was not recognized to be in the same thread as the message of
the original poster (and hence I wasted time to answer it again).

Thanks,
Uwe Ligges




> Dear Kushan, this may be a good start:
>
> ## assuming 'instr.list' is  your list object and you are applying
> my.strat() function on each element of that list, you can use lapply
> function as
> lapply(instr.list, function(x) return(my.strat(x)))
>
> Here resulting element will again be another list with length is same as the
> length of your original list 'instr.list.'
>
> Instead if the returned object for my.strat() function is a single number
> then you might want to create a vector instead list, in that case just use
> 'sapply'
>
> HTH
>
> Arun,
>
>       [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org 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.

______________________________________________
R-help@r-project.org 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.




message may contain confidential information. If you are not the designated 
recipient, please notify the sender immediately, and delete the original and 
any copies. Any use of the message by you is prohibited. 
______________________________________________
R-help@r-project.org 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.

Reply via email to