September 2018
Beginner
206 pages
4h 27m
English
A list is different from a vector because it can hold many different types of R objects inside it, including other lists. If you have experience programming in another language, you may be familiar with lists, but if not, don't worry! You can create a list in R using the list() function, as shown in the following example:
L1 <- list(1, "2", "Hello", "cat", 12, list(1, 2, 3))
Let's walk through the elements of this list. First, we have the number 1. Then, a character string, "2", followed by the character string "Hello", the character string "cat", the number 12, and then a nested list, which contains the numbers 1, 2, and 3.
Accessing these different parts of the list that we just created is slightly different—now, you are using list ...
Read now
Unlock full access