[R] Odp: Programming: loop versus vector oriented
Jan private
jrheinlaender at gmx.de
Sat Sep 18 12:12:29 CEST 2010
Hello Petr,
thank you for your ideas. The split() looks most realistic.
What about this idea:
1. Define three functions Refun1, Refun2, Refun3 for the three different
sections of the calculations (same as you suggested)
2. lambda = (Re <= 2320) * Refun1(Re) + ((Re > 2320) && (Re < 65 * dk))
* Refun2(Re) etc.
But my thought is that probably the values of RefunXYZ will be
calculated for every value of Re, even if the condition (Re <= 2320) is
FALSE (= 0). So that would give a lot of unnecessary function
evaluations.
Regards,
Jan
More information about the R-help
mailing list