Introduction to the inTextSummaryTable package

Introduction

The package inTextSummaryTable contains functionalities to create complex table of summary statistics or counts of variables of interest.

This table can be formatted to static

  • in-text table for a Clinical Study Report,
  • a topline presentation
  • an interactive table, e.g. to be used inside the medical monitoring report.

These tables can be included into a rmarkdown document which can be converted into html, docx and pptx. Each table can be separately exported into a text, docx or htmldocument.

We start the guidance to the functionalities of the inTextSummaryTable, via loading the following packages.

    library(inTextSummaryTable)
    library(pander)
    library(tools) # toTitleCase

Data format

The input data for the creation of summary table should be a data.frame, usually loaded from a SAS data file (sas7bdat format). The label of the variables stored in the SAS datasets is also used for the title or the caption.

Note that the loadDataADaMSDTM function of the clinUtils package can be used to import your study-specific dataset(s) of interest into R.

For this vignette, ADaM datasets included in the clinUtils package are used.

    library(clinUtils)

    # load example data
    data(dataADaMCDISCP01)
    
    dataAll <- dataADaMCDISCP01
    labelVars <- attr(dataAll, "labelVars")
    
    # dataAll contains a list
    class(dataAll)
## [1] "list"
    # ... of ADaM datasets
    names(dataAll)
## [1] "ADAE"     "ADCM"     "ADLBC"    "ADPP"     "ADQSADAS" "ADQSCIBC" "ADQSNPIX" "ADSL"     "ADVS"
    # access a specific dataset
    head(dataAll$ADSL, 1)
##        STUDYID     USUBJID SUBJID SITEID SITEGR1                  ARM               TRT01P TRT01PN               TRT01A TRT01AN     TRTSDT     TRTEDT TRTDUR AVGDD
## 1 CDISCPILOT01 01-701-1148   1148    701     701 Xanomeline High Dose Xanomeline High Dose      81 Xanomeline High Dose      81 2013-08-23 2014-02-20    182  77.1
##   CUMDOSE AGE AGEGR1 AGEGR1N  AGEU  RACE RACEN SEX                 ETHNIC SAFFL ITTFL EFFFL COMP8FL COMP16FL COMP24FL DISCONFL DSRAEFL DTHFL BMIBL BMIBLGR1 HEIGHTBL
## 1   14040  57    <65       1 YEARS WHITE     1   M NOT HISPANIC OR LATINO     Y     Y     Y       Y        Y        Y                         28.3   25-<30    175.3
##   WEIGHTBL EDUCLVL   DISONSDT DURDIS DURDSGR1   VISIT1DT    RFSTDTC    RFENDTC VISNUMEN     RFENDT   DCDECOD  DCREASCD MMSETOT DATASET
## 1     87.1      15 2010-12-12   32.1     >=12 2013-08-14 2013-08-23 2014-02-20       12 2014-02-20 COMPLETED Completed      21    ADSL
    # check label of a subset of the variable(s)
    head(labelVars)
##                     STUDYID                      SITEID                     USUBJID                        TRTA                       TRTAN                         AGE 
##          "Study Identifier"     "Study Site Identifier" "Unique Subject Identifier"          "Actual Treatment"      "Actual Treatment (N)"                       "Age"
    # or for a specific variable:
    labelVars["USUBJID"]
##                     USUBJID 
## "Unique Subject Identifier"
    # or:
    getLabelVar(var = "USUBJID", labelVars = labelVars)
##                     USUBJID 
## "Unique Subject Identifier"

Create your tables

A dedicated vignette on how to create your in-text table is available here).

Table formatting/export

If you are familiar with the creation of the tables, but you are wondering how to:

  • export tables for specific formats as Word/PowerPoint/Html/R object
  • save tables into separated documents
  • set specific text formatting (e.g. superscripts/subscripts)
  • filter and split exported tables

then the the dedicated vignette is available here), or accessible with

vignette("inTextSummaryTable-exportTables", "inTextSummaryTable")

Advanced users

If you are familiar with the creation and export of the tables, and you want to know more on the functionalities less exposed to the users, you can check out the vignette for advanced users, which is available here) and with

vignette("inTextSummaryTable-advanced", "inTextSummaryTable")

Visualization

The inTextSummaryTable has also visualization functionalities based on the computation of summary statistics. The vignette for visualization is available at this) link or through

vignette("inTextSummaryTable-visualization", "inTextSummaryTable")

Aesthetics

The inTextSummaryTable package allow the user to set global options for the color schemes of tables and visualization. The main advantage is that if you wish to change the default palettes, it is possible to set your preferences only once at the beginning of the R script or Rmd document.

The vignette is available via this) link or

vignette("inTextSummaryTable-aesthetics", "inTextSummaryTable")

Appendix

Session information

R version 4.4.2 (2024-10-31)

Platform: x86_64-pc-linux-gnu

locale: LC_CTYPE=en_US.UTF-8, LC_NUMERIC=C, LC_TIME=en_US.UTF-8, LC_COLLATE=C, LC_MONETARY=en_US.UTF-8, LC_MESSAGES=en_US.UTF-8, LC_PAPER=en_US.UTF-8, LC_NAME=C, LC_ADDRESS=C, LC_TELEPHONE=C, LC_MEASUREMENT=en_US.UTF-8 and LC_IDENTIFICATION=C

attached base packages: tools, stats, graphics, grDevices, utils, datasets, methods and base

other attached packages: plyr(v.1.8.9), pander(v.0.6.5), clinUtils(v.0.2.0), inTextSummaryTable(v.3.3.3), knitr(v.1.49) and rmarkdown(v.2.29)

loaded via a namespace (and not attached): gtable(v.0.3.6), xfun(v.0.49), bslib(v.0.8.0), ggplot2(v.3.5.1), htmlwidgets(v.1.6.4), ggrepel(v.0.9.6), vctrs(v.0.6.5), crosstalk(v.1.2.1), generics(v.0.1.3), tibble(v.3.2.1), fansi(v.1.0.6), pkgconfig(v.2.0.3), data.table(v.1.16.2), uuid(v.1.2-1), lifecycle(v.1.0.4), flextable(v.0.9.7), farver(v.2.1.2), compiler(v.4.4.2), stringr(v.1.5.1), textshaping(v.0.4.0), munsell(v.0.5.1), fontquiver(v.0.2.1), fontLiberation(v.0.1.0), htmltools(v.0.5.8.1), sys(v.3.4.3), buildtools(v.1.0.0), sass(v.0.4.9), yaml(v.2.3.10), pillar(v.1.9.0), jquerylib(v.0.1.4), openssl(v.2.2.2), DT(v.0.33), cachem(v.1.1.0), fontBitstreamVera(v.0.1.1), tidyselect(v.1.2.1), zip(v.2.3.1), digest(v.0.6.37), stringi(v.1.8.4), dplyr(v.1.1.4), reshape2(v.1.4.4), maketools(v.1.3.1), labeling(v.0.4.3), forcats(v.1.0.0), cowplot(v.1.1.3), fastmap(v.1.2.0), grid(v.4.4.2), colorspace(v.2.1-1), cli(v.3.6.3), magrittr(v.2.0.3), utf8(v.1.2.4), withr(v.3.0.2), gdtools(v.0.4.1), scales(v.1.3.0), officer(v.0.6.7), askpass(v.1.2.1), ragg(v.1.3.3), hms(v.1.1.3), evaluate(v.1.0.1), haven(v.2.5.4), viridisLite(v.0.4.2), rlang(v.1.1.4), Rcpp(v.1.0.13-1), glue(v.1.8.0), xml2(v.1.3.6), jsonlite(v.1.8.9), R6(v.2.5.1) and systemfonts(v.1.1.0)