- Lists
- A list in R is similar to your to-do list at work or school: the different items on that list most likely differ in length, characteristic, type of activity that has to do be done.
- A list in R allows you to gather a variety of objects under one name (that is, the name of the list) in an ordered way. These objects can be matrices, vectors, data frames, even other lists, etc. It is not even required that these objects are related to each other in any way.
- You could say that a list is some kind super data type: you can store practically any piece of information in it!
- The list of elements can be given names and they can be accessed using these names
- Method 1: Named List
- Method 2: Named List
- Nested List: Create list inside a list
- Single bracket [ versus double bracket [[
- List is collection of vectors
- In above list we have 4 vectors
- First vector is
- Get first vector of list
- Get first element of first vector
- Get second element of first vector? What you observed?
- Get 4 vector 2 element or
- Select elements using names
- Selecting elements using logicals (TRUE,FALSE) .Possible only with single brackets
- Extending list example 1
- Extending list example 2
- Add /remove/update list
Create simple list
Add element
Delete element
update element
update element
- Merge two lists
- Convert list to vector
No comments:
Post a Comment