简体   繁体   English

在R中创建报告

[英]Creating reports in R

I've posted a similar question on Rstudio but I thought it would be useful to also ask stack users. 我在Rstudio上发布了一个类似的问题,但我认为要求堆栈用户也是有用的。

My question is basically this: how do you create documents with embedded R graphics that others can easily comment on? 我的问题基本上是这样的:你如何使用嵌入式R图形创建其他人可以轻松评论的文档?

In the past few months I've been wondering how to circulate R analysis within my company quickly without having to paste lots of plots and tables from R. I'm not interesting in embedding R code, but I do want to be able to customise where my plots go and write text around it (title, headings and paragraphs) from R. The package R2wd has huge potential but Rstudio is making the whole production of high quality documents in HTML, pdf and Latex much more intuitive. 在过去的几个月里,我一直想知道如何在我的公司内快速传播R分析而不必从R中粘贴大量的图表和表格。我对嵌入R代码并不感兴趣,但我确实希望能够自定义从我的情节开始,在它周围写下文字(标题,标题和段落)。包R2wd具有巨大的潜力,但Rstudio正在使HTML,pdf和Latex的高质量文档的整体制作更加直观。 These formats are generally much more flexible, look better, and take full advantage of R's capabilities. 这些格式通常更灵活,看起来更好,并充分利用R的功能。

There are functions generally (but not necessarily correctly) associated with Word which make me (and again I may be wrong) not likely to switch to these other formats. 通常(但不一定正确)与Word相关联的功能使我(并且我可能错了)不太可能切换到这些其他格式。 Once the analysis is finished it is then uploaded on a common drive or circulated electronically, and then colleagues/supervisors/ can: 分析完成后,将其上传到公共驱动器上或以电子方式传播,然后同事/主管/可以:

  1. review the document with Track changes (ie edit the text and then leave you the option to accept changes or not), and 使用跟踪更改查看文档(即编辑文本,然后让您选择是否接受更改),以及
  2. Comment on sections of the text (comments). 评论文本部分(评论)。

These two functions are absolutely crucial when publishing reports on the go (especially new types of analyses which have not been reviewed before), and I was wondering how you'd go about doing this in the formats currently supported by Rstudio (eg HTML, latex, pdf), or just how you generally deal with these issues . 这两个函数在移动发布报告时非常重要(特别是以前未经过审核的新类型的分析),我想知道如何以Rstudio目前支持的格式(例如HTML,latex) ,pdf),或者你通常如何处理这些问题。 I'd love to switch to better formats like pdf but I don't know whether it would mean losing the two functions above. 我想切换到更好的格式,如pdf,但我不知道这是否意味着失去上述两个功能。

In conjunction with the tools that you have discussed (rstudio and sweave/knitr) you might want to look at the pandoc program which will convert from the formats created by those tools into other tools including word .docx files (and others). 结合您讨论过的工具(rstudio和sweave / knitr),您可能希望查看pandoc程序,该程序将从这些工具创建的格式转换为其他工具,包括word .docx文件(和其他)。 So one option would be to create a basic template file in R or Rstudio and use the built in tools to work with and view it while creating it. 因此,一种选择是在R或Rstudio中创建基本模板文件,并使用内置工具在创建时使用和查看它。 Then when you are ready to share the document (with embedded graphs, output, etc.) you can convert to a .docx file and colaboraters can comment and track changes. 然后,当您准备好共享文档(包含嵌入的图形,输出等)时,您可以转换为.docx文件,并且colaboraters可以评论和跟踪更改。

Other options would be to use R2wd (as mentioned in the question, but note that it uses non-free tools) or R2HTML or rtf packages to create those types of files which can be read in using ms word as well. 其他选项是使用R2wd(如问题中所述,但请注意它使用非自由工具)或R2HTML或rtf包来创建可以使用ms字读取的那些类型的文件。

看看Sweave(基础R)和knitr ---以及CRAN任务视图中关于可重复研究的所有内容,这些内容都集中在同一个主题上。

Maybe you can import the knitr'ed HTML into Google Docs. 也许你可以将knitr'ed HTML导入Google Docs。 There you have not only track changes but real time editing. 在那里,您不仅可以跟踪更改,还可以进行实时编辑。 I did not try this, though. 不过,我没试过这个。

Here is my thought about your question. 这是我对你的问题的看法。 Regarding writing a reproducible report (or data analysis), as Dirk has recommended, I would recommend using knitr or Sweave (I personally like knitr more). 关于编写可重现的报告(或数据分析),正如Dirk建议的那样,我建议使用knitr或Sweave(我个人更喜欢knitr)。 In the company I work, I write all my reports in a reproducible format so that it enables people to reproduce my research as well as helping me to easily change some parameters {in my case dosage of using our product} an getting a new report in just a second. 在我工作的公司,我以可重复的格式编写所有报告,以便人们能够重现我的研究,并帮助我轻松更改一些参数{在我的情况下使用我们的产品的剂量}获取新的报告等一下。

Regarding the editing and proofreading part, you can use http://www.mendeley.com/ . 关于编辑和校对部分,您可以使用http://www.mendeley.com/ I do have a private group on Mendeley with my team and I share my reports with them and they can easily comment on the report. 我和我的团队在Mendeley有一个私人小组,我与他们分享我的报告,他们可以轻松评论报告。 We can also share documents with each other. 我们还可以相互分享文件。 It's quite useful to me. 这对我很有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM