While tapply() applies a function to different observations in a vector, which might correspond to rows in a data frame, lapply() and sapply() apply a function to each element of a list. In the case of a data frame, which is a special type of list, these functions will apply a function to each variable in the data frame. The two functions differ in the form of the result that they return. In this video we introduce these functions and illustrate them with examples from the Consumer Reports cars data set.
This topic is important and this video is essential viewing for the course.