用ggvis编织RMarkdown到Word

时间:2014-07-24 17:41:28

标签: knitr r-markdown ggvis vega

当我尝试将带有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_pngvg2png

2 个答案:

答案 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)

enter image description here

如果你经常使用它,你可以定义钩子。

答案 1 :(得分:-1)

  1. 首先转到Node JS Download page
  2. 安装node.js后,在终端运行中:

    npm install vega