I have three text documents stored as a list of lists called \"dlist\":
dlist <- structure(list(name = c(\"a\", \"b\", \"c\"), text = list(c(\"the\", \"quick\
Josh's answer is much sweeter but I thought I'd throw my hat in the ring.
dlist <- structure(list(name = c("a", "b", "c"),
text = list(c("the", "quick", "brown"),
c("fox", "jumps", "over", "the"), c("lazy", "dog"))),
.Names = c("name", "text"))
lens <- sapply(unlist(dlist[-1], recursive = FALSE), length)
data.frame(name = rep(dlist[[1]], lens), text = unlist(dlist[-1]), row.names = NULL)
## name text
## 1 a the
## 2 a quick
## 3 a brown
## 4 b fox
## 5 b jumps
## 6 b over
## 7 b the
## 8 c lazy
## 9 c dog
That being said the list of lists is a bit of an awkward storage method. A list of vectors (particularly named lists of vectors) would be easier to deal with.