How to flatten a list of lists?

后端 未结 3 1554
予麋鹿
予麋鹿 2020-11-28 06:07

The tm package extends c so that, if given a set of PlainTextDocuments it automatically creates a Corpus. Unfortunately,

3条回答
  •  天命终不由人
    2020-11-28 06:42

    I expect that unlist(foolist) will help you. It has an option recursive which is TRUE by default.

    So unlist(foolist, recursive = FALSE) will return the list of the documents, and then you can combine them by:

    do.call(c, unlist(foolist, recursive=FALSE))
    

    do.call just applies the function c to the elements of the obtained list

提交回复
热议问题