A list can be converted to a Vector in R. So that the elements of the vector can be used for further manipulation. All arthimetic operations o vectors can be applied after the the list is converted to vectors. We can convert list to vector using unlist() function. It takes list as input and produces vector as output.

> x< -list(1:3) # Create list x
> typeof(x) #To check type of x
[1] "list"
> x
[[1]]
[1] 1 2 3
> y< -list(3:7) #Create list y
> typeof(y) #TO]o check type of y
[1] "list"
> y
[[1]]
[1] 3 4 5 6 7
**Convert lists to Vectors**
> v1< -unlist(x) #Convert list x to vector v1
> v2< -unlist(y) #Convert list y to vector v2
> typeof(v1) #To check the type of v1
[1] "integer"
> typeof(v2) #To check the type of v2
[1] "integer"

### Like this:

Like Loading...

*Related*

CheapSexCams