toxPlot_byToxicity: Plot toxicities over time

Description Usage Arguments Value See Also Examples

Description

This function plots the worst grade of each toxicity over time. There should be no overlap between toxicities but in the case that there is the wors grade is given priority.

Usage

1
2
3
4
ToxPlot_byToxicity(rt, rowID_range = NULL, plotNow = TRUE,
  plotLeftSideOption = "treatment", xlim = c(-7, 60), xlab = character(0),
  plotCycleLength = 21, plotXLegendScale = "days", permitMarSet = TRUE,
  causality = NULL, events = list(), offsetEvent = NULL)

Arguments

rt

an object of class robustToxicities

rowID_range

optional, a length 2 vector detailing the minimum and maximum row to plot

plotNow

whether to plot the graph or return the number of rows to plot

plotLeftSideOption

What to display on right axis. Options are: "treatment", "patid" or "both". Default is "treatment"

xlim

Range to plot on xaxis. Default is c(-7,60)

xlab

xaxis title / label

plotCycleLength

Cycle length is used to add greater highlights to vertical lines. Default is 21

plotXLegendScale

What scale to use on xaxis. Options are "days","weeks","months". Default is "days"

permitMarSet

Allow the function to set the mar for the plot

causality

Adds causality columns to the plot on the righthand side. This must be an object of type causalityInfo-class

events

a list of Objects of type eventInfo.

offsetEvent

the name of a column in patientData to use as time 0. If not provided the start of assessment date is used

Value

This plot function return the number of row of unique toxicities * patients. This assists in computing optimal size for saved graphs.

See Also

ToxPlot_byPatient, ToxPlot_byTime, ToxPlot_byCycle

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
92
93
94
95
96
# 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)

##########################################################
ToxPlot_byToxicity(rt)

##########################################################
# Subset to a range. Usefull for plotting over a number of figures if there
# are lots of adverse events
ToxPlot_byToxicity(rt, rowID_range = c(1,7))

##########################################################
# subset to a specific set of adverse events
rt@toxData$ass_TRUE = rt@toxData$Treatment == "Placebo"
ToxPlot_byToxicity(rt)

###########################################################
# Add causality data
rt@toxData$ass_TRUE = TRUE

# With causality
# Not provided so generate some for illustrative purposes
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","B"),
  width = 1.5,
  cex = 1.2)

ToxPlot_byToxicity(rt,
                   causality = causality)


#########################################################
# Add event data

event_EOT = ToxPlot_eventInfo(
  columns = c("end_of_treatment_date"),
  label = c("End Of Treatment"),
  lwd = 4,
  col = c("blue")
)

event_EOA = ToxPlot_eventInfo(
  columns = c("end_of_assessment_date"),
  label = c("End Of Assessment"),
  lwd = 4,
  col = c("green")
)

ToxPlot_byToxicity(rt,
                   causality = causality,
                   xlim = c(-7, 100),
                   events = list(event_EOT, event_EOA))


########################################################
# Change offset

event_SOT = ToxPlot_eventInfo(
  columns = c("Registration_date"),
  label = c("Registration Date"),
  lwd = 4,
  col = c("orange")
)

ToxPlot_byToxicity(rt,
                   causality = causality,
                   xlim = c(-67, 40),
                   xlab = "Days from end of treatment",
                   events = list(event_SOT, event_EOT, event_EOA),
                   offsetEvent = "end_of_treatment_date")

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