Bacter Bacter - 5 months ago 27
R Question

R list of lists to data.frame

I've got a list of lists, call it

, which has length 5.

Every element in
is a list of numeric data, with 160 or so elements.

I need to turn this list of lists into a
of length 5, with each element being a numeric vector with 160 or so elements.

But everything I've tried, from iterating through the list of lists and turning each element with
, to

data.frame(matrix(unlist(listHolder), nrow = length(totalKeywords), byrow = T))

ends up creating a data frame of length 160 or so, with each element being a numeric vector with 5 or so elements.

How do I do what I want?

data.frame(matrix(unlist(totalKeywords), nrow=132, byrow=T))
yields the opposite of what I want - 160 small items each 5 elements long.


The value of nrow needs to be fixed. I fixed your code as follows:

    dd  <-, nrow=length(unlist(listHolder[1]))))