Hi,
  
  The following works by appending NA to make up the maximum length of the
list.

> test4
$Row1
[1] "a" "b" "c" "d" "e"

$Row2
[1] "a" "b" "c" "d" "e" "f" "g"

$Row3
[1] "h" "i" "j" "k" "l" "m" "n"

> as.data.frame(t(sapply(1:length(test4),
> function(x){c(test4[[x]],rep(NA,max(sapply(1:length(test4),function(x)length(test4[[x]])))-length(test4[[x]])))})))
  V1 V2 V3 V4 V5   V6   V7
1  a  b  c  d  e <NA> <NA>
2  a  b  c  d  e    f    g
3  h  i  j  k  l    m    n



--
View this message in context: 
http://r.789695.n4.nabble.com/Want-to-convert-list-with-vectore-of-dis-similar-lengths-to-data-frame-tp4704196p4704200.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to