Skip to content
Prev 176249 / 398502 Next

Best way to turn a list into a data.frame

Hi Daniel,

In your case, I guess you could use:

col1 = rep(attributes(my.list)$names,lapply(my.list,length)) ;
col2 = unlist(my.list,use.names=FALSE) ;
my.data.frame = as.data.frame(cbind(col1,col2)) ;

This should work well.

Cheers,

Luc
Daniel Brewer wrote: