The toxTables function

Brie Noble, Blake Langlais

Introduction

The toxTables() function produces structured statistical tables similar to those created for CTCAE data. Tables can show arm-level sample size and frequency distributions for PRO-CTCAE items available in the provided data frame. P-values from chi-squared or Fisher’s exact tests can also be calculated. Additionally, risk-differences between arms can be calculated using provided alpha-level. An R data frame is returned in table format which can be further formatted through R packages, spreadsheets, or directly copy and pasted into a document.

library(ProAE)
require(knitr)

require(kableExtra)

data(tox_acute)

In the examples below, we will use the provided ProAE::tox_acute data frame. This data was simulated to demonstrate a common symptomatic AE profile where the drug group experiences acute toxicity followed by symptom abatement over the course of treatment.

In order to use the toxTables() function the data frame needs to be in long format (multiple rows per patient). Additionally, the cycle variable needs to be numeric.

Example 1 - Default Table

acute <- tox_acute

str(acute)
'data.frame':   1400 obs. of  7 variables:
 $ id             : int  1 1 1 1 1 1 1 1 1 1 ...
 $ Cycle          : int  1 2 3 4 5 6 7 8 9 10 ...
 $ arm            : chr  "Drug" "Drug" "Drug" "Drug" ...
 $ PROCTCAE_9A_SCL: num  0 2 4 0 0 0 0 0 0 0 ...
 $ PROCTCAE_9B_SCL: num  0 2 3 3 0 1 0 0 0 0 ...
 $ PROCTCAE_9_COMP: num  0 2 3 0 0 0 0 0 0 0 ...
 $ time           : chr  "Cycle 1" "Cycle 2" "Cycle 3" "Cycle 4" ...

The toxTables() function can be used to create a summary table that calculate the frequency of patients with nausea scores >= 1 and >= 3 by treatment arm.

The default summary measure used is the baseline adjusted score which is derived by the following:

If the maximum score post-baseline is more severe than the baseline score, then the maximum score post-baseline is used as the adjusted score.

Otherwise, if the maximum score post-baseline is the same or less serve than the baseline score, zero (0) is used as the adjusted score.

table_1 <- toxTables(dsn = acute,
                    id_var="id",
                    cycle_var="Cycle",
                    baseline_val = 1,
                    arm="arm")

We can use the knitr::kable() function to see a simple RMarkdown version of the table.

knitr::kable(table_1$individual)
item_lab Drug_n Placebo_n Drug_pres Placebo_pres pv_pres Drug_sev Placebo_sev pv_sev
Nausea Frequency 70 70 63 (90%) 59 (84%) 0.3125 45 (64%) 34 (49%) 0.0608
Nausea Severity 70 70 61 (87%) 58 (83%) 0.4777 50 (71%) 22 (31%) 0.0000

Example 2 - Customizing tables

Further customization can happen using kable() and kableExtra() or the data frame can be exported to spreadsheet or copy and pasted into a document

knitr::kable(table_1$individual,
             col.names = c('Item/Attribute', 'Drug', 'Placebo', 'Drug', 'Placebo', "p", "Drug", "Placebo", "p"),
             caption = "Table 1. Frequency distributions of patients with nausea score >= 1 and >= 3, by treatment arm") %>%               
             kableExtra::add_header_above(c(" ", "n" = 2,  "Score >= 1" = 2, " ", "Score >= 3" = 2, " ")) %>% 
             kableExtra::add_footnote("p: result from a standard chi square test comparing score threshold frequency distributions between arms",
                          notation = "symbol")
Table 1. Frequency distributions of patients with nausea score >= 1 and >= 3, by treatment arm
n
Score >= 1
Score >= 3
Item/Attribute Drug Placebo Drug Placebo p Drug Placebo p
Nausea Frequency 70 70 63 (90%) 59 (84%) 0.3125 45 (64%) 34 (49%) 0.0608
Nausea Severity 70 70 61 (87%) 58 (83%) 0.4777 50 (71%) 22 (31%) 0.0000
* p: result from a standard chi square test comparing score threshold frequency distributions between arms