Exporting Tools for 'rtables'

Designed to create and display complex tables with R, the 'rtables' R package allows cells in an 'rtables' object to contain any high-dimensional data structure, which can then be displayed with cell-specific formatting instructions. Additionally, the 'rtables.officer' package supports export formats related to the Microsoft Office software suite, including Microsoft Word ('docx') and Microsoft PowerPoint ('pptx').


rtables.officer

Check🛠 Docs📚 Code Coverage📔

GitHubforks GitHub repostars

GitHub commitactivity GitHubcontributors GitHub lastcommit GitHub pullrequests GitHub reposize GitHub languagecount Project Status: Active – The project has reached a stable, usablestate and is being activelydeveloped. OpenIssues

CurrentVersion

Exporting rtables to Microsoft Word and beyond

The rtables.officer package provides a framework to export tables created with rtables to Microsoft Word documents. To do so, we use the officer package to create a Word document and the flextable package to produce the intermediary table object that officer can use to create the Word document.

Please refer to the following packages for further information: - rtables to create tables. - flextable as an intermediate html table object. Many aesthetic functionalities are available at this stage. - officer to create Word documents. Please consider also other exporter options (e.g. html) that are available from flextable.

rtables and rtables.officer is developed and copy written by F. Hoffmann-La Roche and it is released open source under Apache License Version 2.

Installation

rtables.officer is available on CRAN and you can install the latest released version with:

install.packages("rtables.officer")

or you can install the latest development version directly from GitHub with:

# install.packages("pak")
pak::pak("insightsengineering/rtables.officer")

Example

Here’s a simple example demonstrating how to create a basic table layout, perform analysis on various columns, and export the resultant table to a Word document in landscape orientation. Further reading are available in the vignettes.

# Define the table layout
lyt <- basic_table() %>%
  split_cols_by("ARM") %>%
  analyze(c("AGE", "BMRKR2", "COUNTRY"))

# Build the table
tbl <- build_table(lyt, ex_adsl)

# Export the table to a Word document in landscape orientation
tf <- tempfile(fileext = ".docx")
export_as_docx(tbl,
  file = tf,
  section_properties = section_properties_default(orientation = "landscape")
)

# Expected output (with default theme)
tt_to_flextable(tbl, theme = theme_docx_default())

Contributions

To contribute to this package, please fork the repository, create a branch, make your changes, and submit a pull request. Your contributions are greatly appreciated!

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("rtables.officer")

0.1.2 by Joe Zhu, 9 months ago


https://github.com/insightsengineering/rtables.officer, https://insightsengineering.github.io/rtables.officer/


Report a bug at https://github.com/insightsengineering/rtables.officer/issues


Browse source code at https://github.com/cran/rtables.officer


Authors: Gabriel Becker [ctb] , Davide Garolini [aut] , Emily de la Rua [aut] , Abinaya Yogasekaram [aut] (ORCID: , Joe Zhu [aut, cre] , F. Hoffmann-La Roche AG [cph, fnd]


Documentation:   PDF Manual  


Apache License 2.0 license


Imports checkmate, flextable, lifecycle, officer, stats, stringi, systemfonts

Depends on formatters, rlistings, rtables

Suggests car, dplyr, knitr, rmarkdown, tern, testthat, tibble, tidyr, withr, xml2


Imported by junco, teal.reporter.


See at CRAN