Hi Ross,

the trick is especially split() and unsplit(). Split() splits up the
dataframe based on the combined factors, unsplit() transforms it to a
dataframe again. This way you can do the calculation for a set of
mini-dataframes that contain only the information for 1 combination of the
factors.

lapply is the apply-function specifically for lists. As split() gives you a
list of dataframes, lapply loops through those dataframes the appropriate
way. You can see that for yourself by doing str(seal_list).

Hope this clears things out a bit.
Cheers
Joris

On Wed, Jun 2, 2010 at 9:55 AM, RCulloch <ross.cull...@dur.ac.uk> wrote:

>
> Hi Jorvis,
>
> Many thanks for sorting that! I haven't seen it done that way before, so
> I'll have to look in to the properties of lapply a bit more to get a full
> appreciation of other approaches to looping data in R.
>
> Thanks again for your help, it is much appreciated,
>
> Ross
> --
> View this message in context:
> http://r.789695.n4.nabble.com/storing-output-data-from-a-loop-that-has-varying-row-numbers-tp2238396p2239711.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>



-- 
Joris Meys
Statistical Consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

Coupure Links 653
B-9000 Gent

tel : +32 9 264 59 87
joris.m...@ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

        [[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.

Reply via email to