词云 returns 一个词

Wordcloud returns one word

R wordcloud returns只有一个词。"Soft" 这是用于创建 wordcloud

的代码
wordcloud(cambrdf$word,cambrdf$freq,random.order = F,col=terrain.colors(length(cambrdf$word),alpha = 0.5))
structure(list(word = c("goodby", "sky", "western", "are", "bride", 
"glitter", "golden", "heart", "keep", "reflect", "riversid", 
"set", "shimmer", "sun", "their", "undul", "willow", "young", 
"cambridg", "flow", "gentl", "leisur", "mud", "root", "sway", 
"tape", "waterwe", "will", "clear", "crumpl", "duckwe", "elm", 
"hold", "midst", "pool", "rainbow", "rainbowlik", "settl", "shade", 
"spring", "that", "tree", "where", "and", "greener", "laden", 
"long", "pole", "radianc", "seek", "starlight", "upstream", "with", 
"cambridgeridg", "cricket", "farewel", "for", "music", "peac", 
"yet", "away", "gentli", "singl", "sleev", "take", "came", "cloud", 
"just", "leav", "wave", "river", "the", "grass", "green", "water", 
"dream", "loud", "punt", "sing", "even", "now", "silent", "quiet", 
"soft"), freq = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
2, 2, 2, 2, 2, 4)), row.names = c(NA, -84L), class = c("tbl_df", 
"tbl", "data.frame"))

您必须检查 wordcloud 的默认设置。默认情况下,min.freq 为 4。当应用于您的数据集时,只会 return 软,因为它的计数为 3 或更高。如果您将 min.freq 设置为 2,您将获得 data.frame 中的最后 19 个单词。

下面的代码会告诉你最后19个字。

wordcloud(cambrdf$word, cambrdf$freq, min.freq = 2, random.order = F, col = terrain.colors(length(cambrdf$word), alpha = 0.5))