当我尝试使用 ggvis
编织 RMarkdown 文档时绘图到 Word,我从 Rstudio 收到以下消息。
Error: Functions that produce HTML output found in document targeting docx output.
Please change the output type of this document to HTML.
Execution halted
是否存在一个优雅的解决方案(无需太多努力)来实现这一点,也许使用
export_png
和 vg2png
?
最佳答案
这是一个例子:
```{r setup, include=FALSE}
library(dplyr)
library(ggvis)
```
The following table looks fine...
As long as I don't include this plot below
```{r, echo=FALSE, include=FALSE}
p <- pressure %>%
ggvis(x = ~temperature, y = ~pressure) %>%
layer_bars()
export_png(p, file = "hoge.png")
```
![](hoge.png)
如果你会经常使用这个,你可以定义钩子(Hook)。
关于knitr - 用 ggvis 将 RMarkdown 编织到 Word,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24940473/