| Learn | R - Lists - Quick introduction to lists |
|---|
| Quick Introduction to Lists In general, most of the objects you would interact with as a user would tend to be a vector; e.g numeric vector, logical vector. These objects can only take in a single type of variable (a numeric vector can only have numbers inside it). A list would be able to store any type variable in it, making it to the generic object that can store any type of variables we would need. Example of initializing a list In order to understand the data that was defined in the list, we can use the str function. Subsetting of lists distinguishes between extracting a slice of the list, i.e. obtaining a list containing a subset of the elements in the original list, and extracting a single element. Using the To obtain a single element use List entries may be named: The entries in named lists can be accessed by their name instead of their index. Alternatively the This has the advantage that it is faster to type and may be easier to read but it is important to be aware of a potential pitfall. The Lists can be particularly useful because they can store objects of different lengths and of various classes. |
Read Article
https://develop.horje.com/learn/1434/reference