1

我正在尝试制作我的第一个词云,但我对一些我认为很简单的东西有点不知所措。我有一个文本字符串向量,想用它们制作一个词云。我想要两种方法:(1)只需将所有字符串与 paste(x, collapse= " ") 以及(尽管这是较低优先级)(2)我不希望一个字符串支配其他字符串所以我想有它的独特的话只有一个分量。例如,如果一个字符串多次包含相同的单词,我仍然希望将其计为一个。

我看过tmandwordcloud包,但它们似乎都是为更复杂的任务而设计的。我不知道如何Corpus从我的数据中构造一个对象。

我该如何开始?这是一个示例向量,以防万一:

example <- c("this is a string of text", "another string of text", "one more string of text. This could be a few sentences long", "it looks like string is occurring a lot of times", "I hope this example is long enough. If not I can write more sentences")
4

1 回答 1

3

从向量创建语料库的方法是Corpus(VectorSource(example)). 这解决了我的问题

于 2012-06-10T04:18:35.143 回答