List with Names but Empty Elements in R (Example Code)

In this R tutorial you’ll learn how to create a list with names but without entries.

Example: Construct List Object with Empty Elements

example_list <- sapply(letters[1:3],    # Create list
                       function(x) NULL)
example_list                            # Print list
# $a
# NULL
# 
# $b
# NULL
# 
# $c
# NULL

Related Tutorials

In addition, you might want to have a look at the related articles on my homepage:

Leave a Reply

Your email address will not be published.

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top