Excellent work! You learned quite a lot about the
apply family of functions in this section. Let's briefly review what we learned.
apply() functions can be used when you want to perform certain calculations on each member of a list. The three functions we looked at are:
lapply() – takes a list or vector as its first argument and the name of the function to apply as the second. Returns a list.
sapply() – takes a list or vector as its first argument and the name of the function to apply as the second. Simplifies the output by returning a vector or data frame.
tapply() – takes a vector of data, a vector of labels, and a function to apply. Groups the data according to the label using the function provided.
Let's review what we learned with some exercises!