Understand the tapply function and how to apply it in R.