Lists in R
Explore how to create and manipulate lists in R, including naming elements, accessing them by names or index, replacing elements, and merging lists. This lesson builds your skills in managing versatile data structures essential for effective data manipulation.
Create and manipulate lists
Lists are a type of data structure that can encompass a variety of objects, including more complex data types such as matrices and data frames. We can create lists using the list() command.
Most filter and select methods used for vector manipulation also work on lists.
Assign names to list elements
List elements, by default, are labeled with numbers, but it is possible to name list elements by assigning variables to them while creating the list.
Another way to name list elements is to use the names() function. This method changes the names after the list is created. The function outputs the element names, and we can modify ...