I have a character vector that looks like this:
charVec[1:10]
[1] "dentistry" "free" "cache" "key" "containing" "cite" "templates" "deprecated" "errors" "dates"
然后我制作了向量的所有三个字母组合:
combwords <- t(combn(charVec,3))
这让我得到了以下的矩阵组合词:
[,1] [,2] [,3]
[1,] "import" "school" "dentistry"
[2,] "import" "school" "school"
[3,] "import" "school" "log"
[4,] "import" "school" "search"
[5,] "import" "school" "current"
[6,] "import" "school" "advanced"
现在我想为combwords矩阵的每一行创建一个文档术语矩阵(DTM):
word_corpus <- Corpus(VectorSource(combwords))
这没用...我怎样才能让矩阵(combwords)的每一行成为语料库中的一行?