Try this also: t(sapply(my.list, '[', seq(max(sapply(my.list, length)))))
On Sat, Nov 20, 2010 at 9:06 AM, Robert Ruser <robert.ru...@gmail.com>wrote: > Hello, > Let's assume that one has a list: > my.list <- list(a=c(1,2,3,4),b=4,c=c(1:7)) > > I want to save my.list as a matrix in .txt file. Because of different > length we can put NA or 0. > Effect (row.names a, b and c are not necessary) > > a 1 2 3 4 0 0 0 > b 4 0 0 0 0 0 0 > c 1 2 3 4 5 6 7 > > How to do it? > Thank you. > Robert > > ______________________________________________ > R-help@r-project.org mailing list > 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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list 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.