It's Autumn! Prices fall like leaves! - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
The lapply() function
Other apply() functions
11. Converting inputs to lists
The split-apply-combine pattern
Summary

Instruction

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.

Exercise

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