如何在 RMarkdown 中渲染 wordcloud2 的输出

how to render output of wordcloud2 in RMarkdown

如何确保 wordcloud2::wordcloud2() 的输出出现在我的 RMarkdown (HTML) 文档中?

它在 RStudio 中呈现良好,包括在 RMarkdown 文档的预览中,但是当我使用 blogdown 将它上传到我的 netlify 站点时,它没有显示(参见 here,post).有什么想法吗?

编辑:这是我正在使用的代码。就像我说的,它在 RStudio 中完美运行,而不是在网站本身上。

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)
```{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的作者那里找到了解决这个问题的方法