You have been told right, you can do all this and more with the tools of the tidyverse, Here is a free online book where you can learn how to do it. (IMHO using loops is not the best approach)
For getting more specific help, I encourage you to make a REPRoducible EXample (reprex). A reprex makes it much easier for others to understand your issue and figure out how to help.
If you've never heard of a reprex before, you might want to start by reading this FAQ: