Comparison of apply() statements and for() loops