[R] Multiple lapply get-around
Manoj - Hachibushu Capital
Wanzare at HCJP.com
Mon Aug 30 15:45:25 CEST 2004
> Do some calculation based on Fij
> Store Xi,Yj = Fij
To clarify the above two lines: Do some processing for each f for each j and i and store the results in a three dimensional matrix format of i,j,f.
As you would have noticed, the outermost loop is the slowest moving one.
HTH
Manoj
-----Original Message-----
From: Liaw, Andy [mailto:andy_liaw at merck.com]
Sent: Monday, August 30, 2004 9:07 PM
To: Manoj - Hachibushu Capital; r-help at stat.math.ethz.ch
Subject: RE: [R] Multiple lapply get-around
> From: Manoj - Hachibushu Capital
>
> I am faced with a situation wherein I have to use multiple
> lapply's. The
> pseudo-code could be approximated to something as below:
>
> For each X from i=1 to n
> For each Y based on j=1 to m
> For each F from 1 to f
> Do some calculation based on Fij
> Store Xi,Yj = Fij
What does the line above mean? Are you assigning the value of Fij to _both_
Xi and Yj? Doesn't quite make sense to me...
Andy
> End For F
> End for Y
> End for X
>
> Is there anyway to optimize the processing logic further? I *guess*
> using the multiple lapply already optimizes the logic a little bit but
> is there anything else that could be done (apart from the obvious
> solution of writing a c-code)?
>
> TIA
>
> Manoj
>
> ______________________________________________
> R-help at 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
>
>
More information about the R-help
mailing list