There is one more thing people don't notice much. Loops can be made faster if you use right datatype. I checked it once
For loops in #rstats are not slow. Growing a Vector Takes 3000 Times less time than Correcting a predefined Dataframe. list and vectors are even faster than data.table. Something you should Always remember for optimization of #rstats Code.