R – Create Empty List

To create an empty list in R programming, call list() function and pass no arguments in the function call.

In this tutorial, we will learn how to create an empty list in R, using list() function, with the help of example programs.

Syntax

The syntax to create an empty list in R is

</>
Copy
myList <- list()

list() function returns a new list formed with the items given, if any, and is stored in myList.

Examples

In the following program, we will create an empty list using list() function.

example.R

</>
Copy
myList <- list()
print(myList)

Output

list()

Conclusion

In this R Tutorial, we learned how to create an empty list in R programming using list() function, with the help of examples.