Вопрос

I have a list in R looks like, mylist$a, mylist$b, mylist$c, ..., mylist$z. Is there a easier way to combine all those fields of the list into one variable rather then typing a command like cbind(mylist$a,mylist$b,...,mylist$z)?

P.S. All sub-fields has the same dimension.

Это было полезно?

Решение

do.call() calls its first arguments with all the elements in the second argument:

do.call(cbind, mylist)
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top