Converting a List to Vector in R Language - unlist() Function Last Updated : 26 May, 2020 Comments Improve Suggest changes Like Article Like Report unlist() function in R Language is used to convert a list to vector. It simplifies to produce a vector by preserving all components. Syntax: unlist(list) Parameters: 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 Python3 # R program to illustrate # converting list to vector # Creating a list. my_list <- list(l1 = c(1, 3, 5, 7), l2 = c(1, 2, 3), l3 = c(1, 1, 10, 5, 8, 65, 90)) # Apply unlist R function print(unlist(my_list)) Output: 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: Python3 # R program to illustrate # Unlisting list with data frame # Creating a list. my_list <- list(l1 = c(1, 3, 5, 7), l2 = c(1, 2, 3), l3 = c(1, 1, 10, 5, 8, 65, 90)) # Create modified list my_list_2 <- my_list # Add a data frame to the list my_list_2[[4]] <- data.frame(x1 = c(1, 2, 3), x2 = c(4, 5, 6)) # Unlist list with data.frame print(unlist(my_list_2, use.names = FALSE)) Output: [1] 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. Comment More infoAdvertise with us Next Article Converting a List to Vector in R Language - unlist() Function A akhilsharma870 Follow Improve Article Tags : Programming Language R Language R Functions Similar Reads Convert elements of a Vector to Strings in R Language - toString() Function toString() function in R Programming Language is used to produce a single character string describing an R object. Syntax: toString(x, width = NULL) Parameters: x: R objectwidth: Suggestion for the maximum field width. Values of NULL or 0 indicate no maximum. The minimum value accepted is 6 and sma 2 min read Convert an Object to List in R Programming - as.list() Function as.list() function in R Programming Language is used to convert an object to a list. These objects can be Vectors, Matrices, Factors, and dataframes. Syntax: as.list(object) Parameters: object: Vector, Matrix, factor, or data frame R - as.list() Function ExampleExample 1: Converting Vector to list 2 min read Convert values of an Object to Logical Vector in R Programming - as.logical() Function as.logical() function in R Language is used to convert an object to a logical vector. Syntax: as.logical(x)Parameters: x: Numeric or character object R - as.logical() Function ExampleExample 1: Basic example of as.logical() Function in R Programming Language.R # R Program to convert # an object to l 1 min read Convert an Object into a Vector in R Programming - as.vector() Function as.vector() function in R Language is used to convert an object into a vector. Syntax: as.vector(x) Parameters: x: Object to be converted Example 1: Python3 1== # R program to convert an object to vector # Creating an array x <- array(c(2, 3, 4, 7, 2, 5), c(3, 2)) x # Calling as.vector() Function 1 min read Converting a Vector of Type Character into a String Using R In R Language data manipulation often involves converting data types. One common task is converting a vector of type characters into a single string. This article will guide you through the process using base R functions and additional packages like stringr and paste.We will discuss different method 3 min read Like