1 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

1.1 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"

2 Create your tables

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

3 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")

4 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")

5 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")

6 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")

7 Appendix

7.1 Session information

R version 4.4.0 (2024-04-24)

Platform: x86_64-pc-linux-gnu

locale: 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) and knitr(v.1.47)

loaded via a namespace (and not attached): gtable(v.0.3.5), xfun(v.0.44), bslib(v.0.7.0), ggplot2(v.3.5.1), htmlwidgets(v.1.6.4), ggrepel(v.0.9.5), vctrs(v.0.6.5), crosstalk(v.1.2.1), generics(v.0.1.3), curl(v.5.2.1), tibble(v.3.2.1), fansi(v.1.0.6), highr(v.0.11), pkgconfig(v.2.0.3), data.table(v.1.15.4), uuid(v.1.2-0), lifecycle(v.1.0.4), flextable(v.0.9.6), farver(v.2.1.2), stringr(v.1.5.1), compiler(v.4.4.0), textshaping(v.0.4.0), munsell(v.0.5.1), httpuv(v.1.6.15), fontquiver(v.0.2.1), fontLiberation(v.0.1.0), htmltools(v.0.5.8.1), sass(v.0.4.9), yaml(v.2.3.8), later(v.1.3.2), pillar(v.1.9.0), crayon(v.1.5.2), jquerylib(v.0.1.4), gfonts(v.0.2.0), openssl(v.2.2.0), DT(v.0.33), cachem(v.1.1.0), mime(v.0.12), fontBitstreamVera(v.0.1.1), tidyselect(v.1.2.1), zip(v.2.3.1), digest(v.0.6.35), stringi(v.1.8.4), reshape2(v.1.4.4), dplyr(v.1.1.4), labeling(v.0.4.3), forcats(v.1.0.0), cowplot(v.1.1.3), fastmap(v.1.2.0), grid(v.4.4.0), colorspace(v.2.1-0), cli(v.3.6.2), magrittr(v.2.0.3), crul(v.1.4.2), utf8(v.1.2.4), withr(v.3.0.0), gdtools(v.0.3.7), scales(v.1.3.0), promises(v.1.3.0), rmarkdown(v.2.27), officer(v.0.6.6), askpass(v.1.2.0), ragg(v.1.3.2), hms(v.1.1.3), shiny(v.1.8.1.1), evaluate(v.0.24.0), haven(v.2.5.4), viridisLite(v.0.4.2), rlang(v.1.1.4), Rcpp(v.1.0.12), xtable(v.1.8-4), glue(v.1.7.0), httpcode(v.0.3.0), xml2(v.1.3.6), jsonlite(v.1.8.8), R6(v.2.5.1) and systemfonts(v.1.1.0)