本文介绍了用ggvis将RMarkdown编织到Word的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试用ggvis
绘图将RMarkdown文档编织到Word时,我从Rstudio收到以下消息.
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
是否存在一种优雅的解决方案(无需花费太多精力),也许可以使用export_png
和vg2png
?
Does there exist an elegant solution (without too much effort) to make this possible, perhaps using export_png
and 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)
如果您将经常使用它,则可以定义钩子.
If you will use this frequently, you can define hook.
这篇关于用ggvis将RMarkdown编织到Word的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!