将wordcloud2自动导出为html?

时间:2017-01-26 22:45:56

标签: r plot

有没有办法将wordcloud2包生成的文字云自动导出为html,而无需手动点击Export> Save as Web Page(在RStudio)?比如使用pdf保存pdf和使用png保存图片?

以下是生成示例wordcloud的代码

require(wordcloud2)
df = head(demoFreq,50)
wordcloud2(df)

1 个答案:

答案 0 :(得分:5)

require(wordcloud2)
df       <- head(demoFreq, 5)
my_cloud <- wordcloud2(df)
my_path  <- htmltools::html_print(my_cloud) # saves html in temp directory
print(my_path) # the location of the html file.

最好迅速将此文件移至更永久的家中。