Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export wordcloud2 as html automatically?

Tags:

plot

r

Is there a way to export word cloud generated by wordcloud2 package as html automatically without having to manually click on Export > Save as Web Page (in RStudio)? Something like saving pdfs with pdf and images with png?

Here is the code to generate sample wordcloud

require(wordcloud2)
df = head(demoFreq,50)
wordcloud2(df)
like image 410
d.b Avatar asked Jan 26 '17 22:01

d.b


1 Answers

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.

It would be best to swiftly move this file to a more permanent home.

like image 98
Chrisss Avatar answered Sep 29 '22 00:09

Chrisss