r - divide list into vectors -
i have list
:
list <- list(a=1, b=1:3, c=4)
if unlist returns following:
> unlist(list) b1 b2 b3 c 1 1 2 3 4
is there way pull list
apart can get:
a <- 1 b <- 1:3 c <- 4
thanks
following rawr's advice, avoid naming objects "list", "dataframe", etc
a non-optimal solution using for-loop
data
list:
for (i in 1:length(data)) { assign (names(data)[i],data[[i]]) }
checking objects created:
> ls() "a" "b" "c" "data" "i" > [1] 1 > b [1] 1 2 3 > c [1] 4
Comments
Post a Comment