I'm here to tell you that for loops aren't the problem
for loops are a divisive topic in the R community.
R Inferno - https://www.burns-stat.com/pages/Tutor/R_inferno.pdf
GitHub slides - https://github.com/JosiahParry/youtube-tutorials/tree/main/getting-away-with-for-loops
Why loops are slow in R (Florian Privé) - https://privefl.github.io/blog/why-loops-are-slow-in-r/
Advanced R - https://adv-r.hadley.nz/vectors-chap.html
StackOverflow Question - https://stackoverflow.com/questions/54328512/ho