I want to transform the elements of a list into independent vectors that are saved in and usably from the global environment.
Imagine a list "the.list" that consists of three elements.
$a
[1] 1 2 3
$b
[1] 6 7 8
$c
[1] 11 12 13
Is there a way of storing each of the elements as individual vectors?
I have tried to use
lapply (the.list, as.vector)
, but the result is the same as simply printing the list.
Also, using
unlist (the.list)
returns a simple vector of
1:15
, in which the distinct sets
(1:3, 6:8, 11:13
)
are non distinguishable.
I am looking for a function/way to transform the elements of the list into what would would manually be
a<-c(1:3)
b<-c(6:8)
c<-c(11:13)
Many thanks.