Christofer Bogaso <bogaso.christofer <at> gmail.com> writes: [...] > Here my question is, is there any speed reduction if I put them within a > function (I think there may be some speed reduction at least within > for-loop, because that loop needs to call that function many times), > relative to if I used that group of codes as-it-is in many places? [...]
You did not asked for it, you may know it, or may not know it: if you use apply functions and other vector oriented functions, this can bring you a huge speedup, compared to a for-loop. Ciao, Oliver ______________________________________________ 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.