Wie kann ich eine Liste von Listen reduzieren?
Dastm
Paket erweitertc
so dass, wenn eine Reihe von gegebenPlainTextDocument
s es wird automatisch einCorpus
. Leider scheint es, dass jederPlainTextDocument
muss separat angegeben werden.
z.B. Hätte ich:
foolist <- list(a, b, c); # where a,b,c are PlainTextDocument objects
Ich würde dies tun, um eine zu bekommenCorpus
:
foocorpus <- c(foolist[[1]], foolist[[2]], foolist[[3]]);
Ich habe eine Liste mit Listen von'PlainTextDocument
s das sieht so aus:
> str(sectioned)
List of 154
$ :List of 6
..$ :Classes 'PlainTextDocument', 'TextDocument', 'character' atomic [1:1] Developing assessment models Developing models
.. .. ..- attr(*, "Author")= chr "John Smith"
.. .. ..- attr(*, "DateTimeStamp")= POSIXlt[1:1], format: "2013-04-30 12:03:49"
.. .. ..- attr(*, "Description")= chr(0)
.. .. ..- attr(*, "Heading")= chr "Research Focus"
.. .. ..- attr(*, "ID")= chr(0)
.. .. ..- attr(*, "Language")= chr(0)
.. .. ..- attr(*, "LocalMetaData")=List of 4
.. .. .. ..$ foo : chr "bar"
.. .. .. ..$ classification: chr "Technician"
.. .. .. ..$ team : chr ""
.. .. .. ..$ supervisor : chr "Bill Jones"
.. .. ..- attr(*, "Origin")= chr "Smith-John_e.txt"
#etc., all sublists have 6 elements
Also, um alle meine zu bekommenPlainTextDocument
s in aCorpus
Das würde funktionieren:
sectioned.Corpus <- c(sectioned[[1]][[1]], sectioned[[1]][[2]], ..., sectioned[[154]][[6]])
Kann jemand einen einfacheren Weg vorschlagen, bitte?
ETA:foo<-unlist(foolist, recursive=FALSE)
erzeugt eine flache Liste von PlainTextDocuments, die mich immer noch mit dem Problem belässt, eine Liste Element für Element zu fütternc