我一直在研究在rMarkdown中生成图表的diagrammeR包(http://rich-iannone.github.io/DiagrammeR/)。在HTML中呈现文档时,这很有效;现在我的问题是,是否有可能将文档输出为MS Word文档?
例如,考虑以下内容:
---
title: "Test"
author: "Test"
date: "Monday, May 18, 2015"
output: html_document
---
```{r, echo=FALSE, warning=FALSE}if (!require("DiagrammeR"))库(“DiagrammeR”)
Check out this diagram:
```{r, echo=FALSE, results='asis'}DiagrammeR::grViz(“
digraph rmarkdown { node [shape = box ] 'A' -> 'B' } ")使用HTML作为输出格式非常有用。但是,当我切换到MS Word时,我得到的结果是:
Error: Functions that produce HTML output found in document targeting docx output.
Please change the output type of this document to HTML.任何想法都将不胜感激。
非常感谢,菲利普
发布于 2015-08-19 19:35:13
https://github.com/tesseradata/trelliscope:trelliscope很有用
安装http://phantomjs.org/download.html后,您可以通过以下方式生成word文档文件:
---
title: "Test"
author: "Test"
date: "Monday, May 18, 2015"
output: word_document
---
```{r include=FALSE}if (!require("DiagrammeR"))库(“DiagrammeR”)
库(光栅镜)
Check out this diagram:
```{r, include=FALSE}P= DiagrammeR::grViz(“
digraph rmarkdown { node [shape = box ] 'A' -> 'B' } ")widgetThumbnail(p,paste0(getwd(),"/hoge.png"))
这是屏幕截图。它看起来很完美:)

https://stackoverflow.com/questions/30307191
复制相似问题