apply, tapply, by, sapply …. bye bye
At any R Q&A site, you’ll frequently see an exchange like this one:
Q: How can I use a loop to […insert task here…] ?
A: Don’t. Use one of the apply functions.
So, what are these wondrous apply functions and how do they work? I think the best way to figure out anything in R is to learn by experimentation, using embarrassingly trivial data and functions.