tfrmt tfrmt logo

R-CMD-check Codecov test coverage status: experimental CRAN status

The tfrmt package provides a language for defining display-related metadata, which can then be used to automate and easily update output formats.

In clinical trials, displays are generally quite standard, but frequent, highly specific formatting tweaks (e.g., rounding, footnotes, headers) are very common. Prior to data analysis, study teams often generate mock displays to represent the desired end product for sponsors to approve or programmers to replicate. This process is typically highly manual and separate from the programming itself. There is also a high importance placed on verifying the accuracy of the results via a QC (Quality Control) process such as double programming. Finally, there is a movement toward an industry standard data structure for Analysis Results Data “ARD”, which means analysis results datasets will have consistent structures and column names. Specifically, the ARD is long, with 1 record per computed value. For more information about ARDs click here.

tfrmt supports a vision where:

By reducing the amount of repetitive tasks, study teams can focus on the quality and interpretation of the results themselves.

Why tfrmt?

While there are many existing table-making packages in the R ecosystem, they typically fall into one of two categories:

By design, tfrmt is more of the latter, as it is intended to be used after the results have been computed. What makes tfrmt unique, however, is that it offers an intuitive interface for defining and layering standard or custom formats that are often specific to clinical trials. It also offers the novel ability to easily generate mock displays using metadata that will be used for the actual displays. tfrmt is built on top of the powerful gt package, which is intended to support a variety of output formats in the future.


The development version of tfrmt can be installed with:


Input data structure

We expect an input dataset that is long, with 1 record per computed value. Required columns include:


Here is an overview of what is possible with tfrmt:

Other benefits of tfrmt:

More Info

For more information about how to build your own tfrmt mocks/tables (like the one below!), please explore the vignettes.

Example GT Demography Table