Re: [R] using lapply

From: Uwe Ligges <ligges_at_statistik.tu-dortmund.de>
Date: Thu, 10 Mar 2011 10:38:15 +0100

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_at_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_at_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. Received on Thu 10 Mar 2011 - 09:45:53 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 10 Mar 2011 - 17:20:21 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.

list of date sections of archive