# Introduction to the `inTextSummaryTable` package

#### Laure Cougnaud

#### February 22, 2022

# 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 `html`document.

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.2 (2021-11-01)

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

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.6), pander(v.0.6.4), clinUtils(v.0.1.1), inTextSummaryTable(v.3.1.1) and knitr(v.1.37)

loaded via a namespace (and not attached): tidyselect(v.1.1.1), xfun(v.0.29), reshape2(v.1.4.4), purrr(v.0.3.4), haven(v.2.4.3), colorspace(v.2.0-3), vctrs(v.0.3.8), generics(v.0.1.2), htmltools(v.0.5.2), viridisLite(v.0.4.0), yaml(v.2.3.5), base64enc(v.0.1-3), utf8(v.1.2.2), rlang(v.1.0.1), jquerylib(v.0.1.4), pillar(v.1.7.0), glue(v.1.6.1), gdtools(v.0.2.4), uuid(v.1.0-3), lifecycle(v.1.0.1), stringr(v.1.4.0), munsell(v.0.5.0), gtable(v.0.3.0), zip(v.2.2.0), htmlwidgets(v.1.5.4), evaluate(v.0.15), labeling(v.0.4.2), forcats(v.0.5.1), fastmap(v.1.1.0), crosstalk(v.1.2.0), fansi(v.1.0.2), highr(v.0.9), Rcpp(v.1.0.8), scales(v.1.1.1), DT(v.0.20), jsonlite(v.1.7.3), farver(v.2.1.0), systemfonts(v.1.0.4), ggplot2(v.3.3.5), hms(v.1.1.1), digest(v.0.6.29), stringi(v.1.7.6), dplyr(v.1.0.8), ggrepel(v.0.9.1), cowplot(v.1.1.1), grid(v.4.1.2), cli(v.3.2.0), magrittr(v.2.0.2), tibble(v.3.1.6), crayon(v.1.5.0), pkgconfig(v.2.0.3), ellipsis(v.0.3.2), data.table(v.1.14.2), xml2(v.1.3.3), rmarkdown(v.2.11), officer(v.0.4.1), flextable(v.0.6.10), R6(v.2.5.1) and compiler(v.4.1.2)