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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -