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" "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.1.0 (2021-05-18)

Platform: x86_64-pc-linux-gnu (64-bit)

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

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

other attached packages: clinUtils(v.0.0.1), pander(v.0.6.4), inTextSummaryTable(v.3.0.1) and knitr(v.1.33)

loaded via a namespace (and not attached): tidyselect(v.1.1.1), xfun(v.0.24), bslib(v.0.2.5.1), reshape2(v.1.4.4), purrr(v.0.3.4), haven(v.2.4.1), colorspace(v.2.0-2), vctrs(v.0.3.8), generics(v.0.1.0), htmltools(v.0.5.1.1), viridisLite(v.0.4.0), yaml(v.2.2.1), base64enc(v.0.1-3), utf8(v.1.2.1), rlang(v.0.4.11), jquerylib(v.0.1.4), pillar(v.1.6.1), glue(v.1.4.2), gdtools(v.0.2.3), uuid(v.0.1-4), lifecycle(v.1.0.0), plyr(v.1.8.6), stringr(v.1.4.0), munsell(v.0.5.0), gtable(v.0.3.0), zip(v.2.2.0), htmlwidgets(v.1.5.3), evaluate(v.0.14), forcats(v.0.5.1), crosstalk(v.1.1.1), fansi(v.0.5.0), Rcpp(v.1.0.7), scales(v.1.1.1), DT(v.0.18), jsonlite(v.1.7.2), systemfonts(v.1.0.2), ggplot2(v.3.3.5), hms(v.1.1.0), digest(v.0.6.27), stringi(v.1.6.2), dplyr(v.1.0.7), ggrepel(v.0.9.1), cowplot(v.1.1.1), grid(v.4.1.0), magrittr(v.2.0.1), sass(v.0.4.0), tibble(v.3.1.2), crayon(v.1.4.1), pkgconfig(v.2.0.3), ellipsis(v.0.3.2), data.table(v.1.14.0), xml2(v.1.3.2), rmarkdown(v.2.9), officer(v.0.3.18), flextable(v.0.6.6), R6(v.2.5.0) and compiler(v.4.1.0)