将 docx 转换为 Rmarkdown [英] Convert docx to Rmarkdown
问题描述
我的工作流程看起来涉及生成包含数据分析的 Microsoft Word 报告(使用 Rmarkdown).然后使用 Word 的标注注释功能对这些报告进行审查和注释.对 Word 文档中的注释进行编辑更容易,这就是我所做的.我现在想将这些更改转移到 Rmarkdown 文档中.我该怎么做?
My workflow looks involves producing Microsoft Word reports (using Rmarkdown) containing analysis of data. These reports are then reviewed and commented using Word's call-out comments feature. It's easier to make edits addressing the comments within the Word document, so that's what I do. I would now like to carry over these changes onto the Rmarkdown document. How can I do this?
我可以直接将 docx 转换为 Rmarkdown 吗?我知道我可以使用 Pandoc 将 docx 转换为 Markdown.
Can I convert docx to Rmarkdown directly? I'm aware I can convert docx to markdown using Pandoc.
推荐答案
以下是从 .docx Word 文件转换为 R markdown,然后再转换为 HTML 的示例.
Here's an example of converting from a .docx Word file to R markdown, and then to HTML.
require(rmarkdown);require(devtools)
examplefile=paste0(tempdir(),"/example.docx")
download.file("https://file-examples.com/wp-content/uploads/2017/02/file-sample_100kB.docx",destfile=examplefile)
pandoc_convert(examplefile,to="markdown",output = "example.rmd", options=c("--extract-media=."))
render(paste0(tempdir(), "/example.rmd"),"html_document")
browseURL(paste0(tempdir(),"/example.html"))
这篇关于将 docx 转换为 Rmarkdown的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!