Create List with Single Value in R (Example)


This page illustrates how to create a list containing only one value in R programming.

The article will contain one example for the construction of a list containing only one element. More precisely, the article looks as follows:

With that, let’s dive into it!


Example: Construct List with Single Value Using list() Function

The following R programming syntax demonstrates how to create a list with only one single list item.

For this task, we simply have to specify the value that we want to use within the list function.

Have a look at the following R code and its RStudio console output:

my_list <- list(10)        # Create list
my_list                    # Print list
# [[1]]
# [1] 10

We have created a list containing the single value 10.


Video & Further Resources

Do you need further info on the R code of this tutorial? Then you could watch the following video on my YouTube channel. I explain the contents of this post in the video.



Besides that, you could have a look at the related tutorials on my homepage. I have released several posts already:


This article has explained how to construct a list with a single element in the R programming language. If you have additional comments and/or questions, let me know in the comments.


Subscribe to the Statistics Globe Newsletter

Get regular updates on the latest tutorials, offers & news at Statistics Globe.
I hate spam & you may opt out anytime: Privacy Policy.

Leave a Reply

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

Fill out this field
Fill out this field
Please enter a valid email address.