On Mon, 22 Dec 2008, Brigid Mooney wrote:
Hi All,
I'm still pretty new to using R - and I was hoping I might be able to get
some advice as to how to use 'apply' or a similar function instead of using
nested for loops.
Unfortunately, you have given nothing that is reproducible.
The details of MyFunction and the exact structure of the list objects are
crucial.
Check out the _Posting Guide_ for hints on how to formulate a question
that will elecit an answer that helps you.
HTH,
Chuck
Right now I have a script which uses nested for loops similar to this:
i <- 1
for(a in Alpha) { for (b in Beta) { for (c in Gamma) { for (d in Delta) {
for (e in Epsilon)
{
Output[i] <- MyFunction(X, Y, a, b, c, d, e)
i <- i+1
}}}}}
Where Output[i] is a data frame, X and Y are data frames, and Alpha, Beta,
Gamma, Delta, and Epsilon are all lists, some of which are numeric, some
logical (TRUE/FALSE).
Any advice on how to implement some sort of solution that might be quicker
than these nested 'for' loops would be greatly appreciated.
Thanks!
[[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.
Charles C. Berry (858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cbe...@tajo.ucsd.edu UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901
______________________________________________
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.