Lists

In this lesson, we will learn all about lists and how to create them.

Previously, we learned about vectors, which are containers where each element has the same type. However, R language provides programmers with the ability to put elements of different types into a single container.

How cool is that! And this is exactly where lists come in the picture.

A list is basically a vector in which all the elements can be of a different type.

Creating Lists

Lists can be created using the list() function.

It works similar to the c() function.

In this function, list the contents you want to add as arguments to the list() function.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy