Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
The lapply() function
6. Calling lapply()
Other apply() functions
The split-apply-combine pattern
Summary

Instruction

Here is our task again: for each day of the week, we would like to see the morning sales (between 6 a.m. and 11 a.m.). This data is stored in the sales list between indexes 7 and 12, inclusive (because the sales for a given day start at midnight, 12 a.m.).

Exercise

Now, use the lapply() and morning_sales() functions to calculate the total number of pieces sold each day in the morning (from 6 a.m. to 11 a.m).

Stuck? Here's a hint!

Type:

lapply(sales, morning_sales)