当我尝试将带有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
?
答案 0 :(得分:1)
以下是一个例子:
```{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)
如果你经常使用它,你可以定义钩子。
答案 1 :(得分:-1)
安装node.js后,在终端运行中:
npm install vega