4

How can I make sure that the output of wordcloud2::wordcloud2() appears in my RMarkdown (HTML) document?

It renders fine in RStudio, including in the preview of the RMarkdown document, but when I upload it to my netlify site with blogdown, it doesn't show (see here, bottom of the post). Any ideas?

Edit: here's the code I'm using. Like I said, it works perfectly in RStudio, just not on the website itself.

library(tidyRSS)

five38 <- tidyfeed("http://fivethirtyeight.com/all/feed")
library(wordcloud2)

topics <- five38$item_category1 %>% append(five38$item_category2) %>% 
  append(five38$item_category3) %>% 
  append(five38$item_category4) %>% 
  append(five38$item_category5)

Topics <- data_frame(
  words = topics
) %>% 
  filter(!is.na(words)) %>% 
  group_by(words) %>% 
  tally()

wordcloud2(Topics)
4

1 回答 1

3
```{r}
library(htmlwidgets)
install.packages("webshot")
webshot::install_phantomjs()
library(wordcloud2)
hw = wordcloud2(demoFreq,size = 3)
saveWidget(hw,"1.html",selfcontained = F)
webshot::webshot("1.html","1.png",vwidth = 700, vheight = 500, delay =10)
```
![](1.png)

好的,我从wordcloud2的作者那里找到了解决这个问题的方法。

于 2017-12-21T17:50:00.420 回答