问题
When I try to knit a RMarkdown document with ggvis
plots to Word, I get the following message from 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
Does there exist an elegant solution (without too much effort) to make this possible, perhaps using export_png
and vg2png
?
回答1:
Here is an example:
```{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)
If you will use this frequently, you can define hook.
回答2:
- First go to Node JS Download page
After instaling node.js, in terminal run:
npm install vega
来源:https://stackoverflow.com/questions/24940473/knitting-rmarkdown-with-ggvis-to-word