[R] Nested lapply? Is this allowed?

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Nov 1 13:44:00 CET 2011


For short:
1. I wonder if you cannot make the two steps one and hence only need one 
lapply anway.
2. Why not just try out?
3. If it does not work, ordinary loops may be able to.

best,
Uwe Ligges



On 01.11.2011 09:24, Alaios wrote:
> Dear all,
>
> I want for a given data set to call a funciton many time. That bring us all to the notion of lapply (or any other variance). My problem is that this data set should also be created from another lapply
>
> As for example
>
>
>
>     DataToAnalyse<- return_selected_time_interval(TimeStamps,Time[[1]], Time[[2]])  # Where Time[[1]] and Time[[2]] are lists
>          return(lapply(do_analysis(DataToAnalyse)))
>
>
> as you can see the DataToAnalyse should be also an lapply. For the list of give Time (Time[[1]] and Time[[2]]) should create a list DataToAnalyse.
>
> My concern though is that the DataToAnalyse for all the Time is huge so I was looking for something memory efficient that can do something like that
>
> Create Data To Analyse-->feed it into do_analysis-->store result into a list(The result is small). Repeat that sentence for all Time
>
> How I can do something like that efficiently in R?
>
> B.R
> Alex
> 	[[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.



More information about the R-help mailing list