lapply() is a really useful function but it has some limitations. For example, with lapply() there is no way to:
- add new elements
- remove existing elements
- change the names of list elements
To overcome these problems we could create a variant of lapply() than I'm going to call fapply() (where f is for flexible). Rather than calling the supplied function with with an element of the list extract with [[, it will call it with a sub-list extracted with [.