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?
Hi Mohamed,
It works. Thank you very much.
Best,
Robert
2010/11/20 mohamed.laj...@inserm.fr:
Hi Robert,
Try to do this
Len - max(sapply(my.list, length))
fun1 - lapply(my.list, function(x){
c(x, rep(0, Len))[1:Len]
})
do.call(rbind, fun1)
M
Regards
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.comwrote:
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
3 matches
Mail list logo