highcharter可以制作词云吗?
Is it possible to create a Word Cloud with highcharter?
我用下面的代码试过了,但不知何故它对我不起作用:
x4是数据帧,n1是字符串,n2是每个词的计数。
hchart(x4 ,"wordcloud", hcaes(name = "n1", weight = "n2"))
highcharter中有词云功能,按此代码
data(reuters, package = "kernlab")
text = paste(
reuters[[1]])
textcld <- text %>%
map(str_to_lower) %>%
reduce(str_c) %>%
str_split("\s+") %>%
unlist() %>%
data_frame(word = .) %>%
count(word, sort = TRUE) %>%
anti_join(tidytext::stop_words)
hchart(textcld, "wordcloud", hcaes(name = word, weight = log(n)))
并且应该得到如下图所示的内容:
enter image description here
我用下面的代码试过了,但不知何故它对我不起作用:
x4是数据帧,n1是字符串,n2是每个词的计数。
hchart(x4 ,"wordcloud", hcaes(name = "n1", weight = "n2"))
highcharter中有词云功能,按此代码
data(reuters, package = "kernlab")
text = paste(
reuters[[1]])
textcld <- text %>%
map(str_to_lower) %>%
reduce(str_c) %>%
str_split("\s+") %>%
unlist() %>%
data_frame(word = .) %>%
count(word, sort = TRUE) %>%
anti_join(tidytext::stop_words)
hchart(textcld, "wordcloud", hcaes(name = word, weight = log(n)))
并且应该得到如下图所示的内容: enter image description here