On 10.03.2011 03:46, Kushan Thakkar wrote:
I have a function with the follow signare:

apply.strategy(instr, strat)

where instr and strat are both objects of classes instrument and strategy
respectively.

I want to apply this function to a list that holds objects of the class
instrument.

Currently I am doing this by explicit looping:

for(i in length(instr.list) ) {
     apply.strategy(instr.list[[i]], my.strat)
}


lapply(instr.list, apply.strategy, strat=mystrat)

Uwe Ligges




Is it possible to achieve this task by using one of the built in functions
in R? I have looked at lapply but can't quite figure out how to pass the
arguments.

What would be the performance implications of one method vs. the other?

Thanks,
Kushan

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

______________________________________________
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