unlist() function in R Language is used to convert a list to vector. It simplifies to produce a vector by preserving all components.
list: It is a list or Vector
use.name: Boolean value to prserve or not the position names
Example 1: Converting list numeric vector into a single vector
l11 l12 l13 l14 l21 l22 l23 l31 l32 l33 l34 l35 l36 l37 1 3 5 7 1 2 3 1 1 10 5 8 65 90
Here in the above code we have unlisted my_list using
unlist() and convert it to a single vector.
As illustrated above, the list will dissolve and every element will be in the same line as shown above.
Example 2: Unlisting list with dataframe:
 1 3 5 7 1 2 3 1 1 10 5 8 65 90 1 2 3 4 5 6
Here in the above code we have modified the previous list and added new elements to “my_list_2” and used the function
unlist() on it.
Also we set the “use.name” parameter to “FALSE” so we will not see the position names of the values in the vector.
- Convert an Object into a Vector in R Programming - as.vector() Function
- Check for the Existence of a Vector Object in R Programming - is.vector() Function
- Create a Vector of Colors from a Vector of Gray Levels in R Programming - gray() or grey() Function
- Find Location and Character Vector of an Object with partial name in R Language - apropos() and find() Function
- Convert elements of a Vector to Strings in R Language - toString() Function
- Generate a Vector of specified length with each element as a unique color on RGB scale in R Language - topo.colors() Function
- Generate a Vector of specified length with each element as a unique color on RB scale in RGB spectrum in R Language - cm.colors() Function
- Generate a Vector of specified length with each element as a unique color on RG scale in RGB spectrum in R Language - terrain.colors() Function
- Difference Between C Language and LISP Language
- Add Leading Zeros to the Elements of a Vector in R Programming - Using paste0() and sprintf() Function
- Check if Elements of a Vector are non-empty Strings in R Programming - nzchar() Function
- Make Elements of a Vector Unique in R Programming - make.unique() Function
- Compute the gamma value of a Non-negative Numeric Vector in R Programming - gamma() Function
- Check if values in a vector are True or not in R Programming - all() and any() Function
- Getting Match of an Element within a Vector in R Programming - charmatch() Function
- Replace the Elements of a Vector in R Programming - replace() Function
- Extracting Substrings from a Character Vector in R Programming - substring() Function
- Find String Matches in a Vector or Matrix in R Programming - str_detect() Function
- Creating a Vector of sequenced elements in R Programming - seq() Function
- Convert a Vector into Factor in R Programming - as.factor() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.