使用 R 的 tm 包,VectorSource 生成列表而不是语料库

问题描述 投票:0回答:0

以下代码...

library(tm)

vectorOfText <- c("twas brillig and the slithey toves", 
                  "did gyre and gimble in the wabes")
names(vectorOfText) <- c("firstLine", "secondLine")

aCorpus <- VCorpus(VectorSource(vectorOfText))

产生

aCorpus
List of 2 - 它应该产生一个 VCorpus。至少,List of 2 显示在 RStudio 环境窗口中。

但是,

class(aCorpus)
在控制台中执行会生成正确的类。例如

> class(aCorpus)
[1] "VCorpus" "Corpus"

这是 tm 和 RStudio 之间的已知问题吗?

r tm corpus
© www.soinside.com 2019 - 2024. All rights reserved.