rdocx
Introduction
In clinical trials we work in interdisciplinary teams where the discussion of outputs is often facilitated using static documents. We wanted to bring the advantages of modern tools (R, markdown, git) and software development practices to the production of company documents. We used an object-oriented approach to create classes for report items with a suite of tests. Finally, the report is rendered programmatically in docx format using a company template. This enables our statisticians to work in a truly end to end fashion within a GxP environment with the end product in a format suitable for interdisciplinary collaboration.
For the open-source version of our package we have replaced our company template/s with a generic template that demonstrates the functionality of the package. In most cases, you prefer to provide a custom template to enforce your desired formatting. In that case, please ensure that the classes are compatible with your template and adjust as needed.
The use cases
As for now, there are two main applications of {rdocx}:
Generic Report: As our first use case, the Generic Report Rmd template allows the user to create a report in RMarkdown and render it directly from R into a Word document following the style of the Generic Report Word template that is used as a reference document by the Generic Report Rmd template.
Automated Reporting: Allows the user to automatically update all or selected tables/figures in a Word document.
Installation
{rdocx} can be installed from Gitlab using (update before pushing to Github)
devtools::install_github("Novartis/rdocx",
ref='main',
build_vignettes=TRUE,
lib='~/R')
Remember to set the parameter lib
to the desired location for installation, as it will be installed in your local directory.
Usage
library('rdocx', lib.loc="~/R")
For quick access to the documentation, visit rdocx site. Read the vignettes on how to use the package with step-by-step examples online:
Or call the vignettes directly in R:
vignette("generic_report", package = "rdocx")
vignette("automated_reporting", package = "rdocx")