Create a List in R

A list is a data structure that can hold any number and any types of other data structures. list in R is similar to a to-do list. It is a kind of super data type which can store any piece of information in it. A list in R allows grouping a variety of objects under one name in an ordered way. These objects can be matrices, vectors, data frames, even other lists, etc. 

Problem:

Create a List in R

Solution:

Create a list in R with Vectors of different data types:

 Create a List of different data types and of different structure

To put names on the components of a list we can use the names() function. This helps in extracting the components. Also, list can be created as named list.

Thank You for reading!
0

Leave a Reply

Your email address will not be published. Required fields are marked *