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:
- Add Key Value Pair to List
- Combine List of Vectors to Single Vector
- Create List of Installed Packages in R
- Create List of Vectors in R
- All R Programming Examples
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.
Thank you!
Welcome to the Statistics Globe newsletter. From now on, I’ll send you regular emails about statistics, data science, AI, and programming with R and Python.
I’m Joachim Schork. On this website, I provide statistics tutorials as well as code in Python and R programming.
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.
Thank you!
Please check your email inbox and click the confirmation link to complete your subscription. If you don’t see the email within a few minutes, please also check your spam/junk folder.






