0

RでパッケージのTermDocumentMatrix関数を使ってterm-document matrixを作ろうとしているのですが、いくつかの単語が含まれていないことがわかりました。tm

> library(tm)
> tdm <- TermDocumentMatrix(Corpus(VectorSource("The book is of great importance.")))
> rownames(tdm)
[1] "book"        "great"       "importance." "the" 

ここでは、単語isおよびofがマトリックスから除外されています。コーパスに削除された単語のみが含まれている場合、次のメッセージが表示されます。

> tdm <- TermDocumentMatrix(Corpus(VectorSource("of is of is")))
Warning message:
In is.na(x) : is.na() applied to non-(list or vector) of type 'NULL'
> rownames(tdm)
NULL

isおよびofのメッセージ シグナルはマトリックスが構築される前に削除されますが、なぜそれが発生するのか、またコーパスにすべてのトークンを含める方法を理解できませんでした。

どんな助けでも大歓迎です。

4

1 に答える 1