我正在尝试显示 wordcloud2 wordcloud,但它仅适用于 html-knitted Rmd 文件。这有效:
---
title: "Untitled"
output: html_document
---
```{r wordcloud}
library(wordcloud2)
wordcloud2(demoFreq)
```
但这不会:
---
title: "Untitled"
output: pdf_document
---
```{r wordcloud}
library(wordcloud2)
wordcloud2(demoFreq)
```
它会在 YAML 中使用 always_allow_html: yes 编织,但 wordcloud 不会出现:
---
title: "Untitled"
output: pdf_document
always_allow_html: yes
---
```{r wordcloud}
library(wordcloud2)
wordcloud2(demoFreq)
```
我在想也许将图形保存为图像,然后将其加载到 .Rmd 中,但这似乎很笨拙。更好的想法?