SetupRobustToxicities: robustToxicitiesClass generator

Description Usage Arguments Details Value Examples

Description

The robustToxicities package aims to make creating publication ready table and graphs from time based toxicity data easy. The package also performs some built in data cleaning actions.

Usage

1
2
3
4
5
SetupRobustToxicities(toxData, patientData, patidCol, treatmentCol = NULL,
  toxCategoryCol, toxNameCol, toxGradeCol, dateOfStartOfToxWindow,
  dateOfStartTox, dateOfEndTox, dateOfEndOfToxWindow,
  periodDividerCols = character(0), periodDividerLabels = character(0),
  treatmentCodes = NULL, treatmentLabels = NULL, options = NULL)

Arguments

toxData

The toxicity level data set

patientData

The patient level data

patidCol

Column name for the participant identifier

treatmentCol

Column name for the treatment. Will be created if not provided

toxCategoryCol

Column name for aderse event category

toxNameCol

Column name for adverse event name

toxGradeCol

Column name for the adverse event grade

dateOfStartOfToxWindow

Column name for date of study entry (eg registration)

dateOfStartTox

Column name for date of adverse event start or change in grade

dateOfEndTox

Column name for date of adverse event end or change in grade

dateOfEndOfToxWindow

Column name for the end of the time window for the particitant to be observed for toxicities (optional)

periodDividerCols

Column names for date dividing times into periods or cycles (optional)

periodDividerLabels

Display names for data periodDividerCols param treatmentLabels A vector of treatment labels

treatmentCodes

Levels of treatment in the treatmentCol

treatmentLabels

What to name each treatment in output tables

options

Optional. An object of class toxicityOptions. The easiest place to start is with DefaultToxicityOptions(). See DefaultToxicityOptions for more details on options.

Details

Run this to create an object of class robustToxicitiesClass. Then run it through QueryRobustToxicities to check for errors before creating tables and graphs of the data.

This function takes two linked data.frames. A one row per patient, patient level data.frame (patientData) and a one row per toxicity data.frame of toxicities (toxData). The remaining parameters tell the package where the columns which are required to create the plots and graphs are. There is also an options class (toxicityOptions-class) which can be edited from the default later. Since the robustToxicitiesClass object is an s4 class slots are accessed using the @ symbol.

Value

An object of class robustToxicitiesClass

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Patient Level Data
data("rt_patientData")
# Toxicity Level Data
data("rt_toxicityData")


# Run the setup command passing in all the column names.
rt = SetupRobustToxicities(
  toxData = rt_toxicityData,
  patientData = rt_patientData,
  patidCol = "patientNo", treatmentCol = "Treatment",
  toxCategoryCol = "category", toxNameCol = "toxicity",
  toxGradeCol = "grade", dateOfStartOfToxWindow = "Registration_date",
  dateOfStartTox = "ae_onset_date", dateOfEndTox = "ae_resolve_date",
  dateOfEndOfToxWindow = "end_of_assessment_date",
  periodDividerCols = c("Registration_date", "Cycle_1_date","Cycle_2_date",
                        "Cycle_3_date", "Cycle_4_date", "Cycle_5_date", "Cycle_6_date"),
  periodDividerLabels = c("Pre treatment", "Cycle 1","Cycle 2",
                          "Cycle 3","Cycle 4","Cycle 5", "Cycle 6"),
  treatmentCodes = NULL, treatmentLabels = NULL, options = NULL)

# Look for queries. Note: must be called before running any
# of the functions on this class.
rt = QueryRobustToxicities(rt)

###########################################################
# Table Examples.
###########################################################
# Summary, worst grade by cycle
ToxTable_summary(rt)

# ReporteRs flextable version
ft = FT_ToxTable_summary(rt)
ft$GetTable()


# Worst grade by patient for each toxicity type
ToxTable_cycle(rt)

# ReporteRs flextable version
ft = FT_ToxTable_cycle(rt)
ft$GetTable()

# Worst grade by category
ToxTable_category(rt)

# ReporteRs flextable version
ft = FT_ToxTable_category(rt)
ft$GetTable()

# Alternative style for worst grade by category
ToxTable_categories(rt)

###########################################################
# Plot Examples
###########################################################
ToxPlot_byToxicity(rt)

# With causality
# Not provided so generate some
rt@toxData$causality1 = sample(1:5,28, replace = TRUE)
rt@toxData$causality2 = sample(1:5,28, replace = TRUE)

causality = ToxPlot_causalityInfo(
  columns = c("causality1","causality2"),
  names = c("A","BA"),
  width = 1.5,
  pch = c(NA,NA,4,8,16),
  cex = 1.2)


ToxPlot_byToxicity(rt,
                   causality = causality)




ToxPlot_byPatient(rt)

ToxPlot_byCycle(rt)

###########################################################
# Alternative specification to cycles
###########################################################
# wrapper for toxPlot_byCycle adding alternative boundaries
timeBoundaries = c(0,21,42,63,84,105,126)
rt2 = CreateTimeDividers(rt, timeBoundaries)
ToxTable_summary(rt2)


ToxPlot_byTime(rt, timeBoundaries = timeBoundaries)

csmoxford/robustToxicities documentation built on May 14, 2019, 12:24 p.m.