Working With Lists

As you proceed with your data analysis journey, you will realize that working with vectors and matrices is a significant limitation, since many data sets include columns with different data types. Thankfully, there’s an answer for this: lists in R.

In this lesson, you will learn how to work with data stored in lists, which can contain multiple types of objects. The objects may consist of different data structures, including single data elements, vectors, and matrices. Storing objects in lists allows us to make use of some powerful R features for performing the same operation on each object in your list, which can help you avoid having to perform that repetition manually.

In addition to learning what lists are and the anatomy of a list, in this lesson, you will also learn how to: assign names to list objects, modify elements, add elements, and combine lists.

After you finish this lesson, you will be well-equipped to start building simple programs in R; what you build is limited by the depth of your imagination. If you have trouble coming up with ideas, you can practice by following this tutorial to build a simple calculator and maybe some additional ideas for programs will come to mind.


  • Learn to create, add elements to, and edit lists.
  • Index lists to extract objects and specific elements.

Lesson Outline

1. Lists: Objects That Can Contain Multiple Data Types
2. Anatomy of a List
3. Assigning Names to List Objects
4. Indexing Lists
5. Modifying List Elements
6. Adding Elements to Lists
7. Combining Lists
8. Next Steps
9. Takeaways

Take a Look Inside