Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
The lapply() function
Other apply() functions
11. Converting inputs to lists
The split-apply-combine pattern


Cool! As it turns out, the input to lapply() and sapply() doesn't have to strictly be a list. Both lapply() and sapply() use the as.list() function to convert their argument to a list.

The as.list() function converts other R objects (like vectors or data frames) into a list. Let's see how this works.


We've put our sales into a data frame named sales_df. Use as.list() to convert the data frame to a list.