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