-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmake_fig_03.Rd
85 lines (70 loc) · 3.42 KB
/
make_fig_03.Rd
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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fda-fig_03.R
\name{make_fig_03}
\alias{make_fig_03}
\title{FDA Figure 3: Time to Adverse Event Leading to Treatment Discontinuation, Safety Population, Trial X}
\usage{
make_fig_03(
df,
arm_var = "ARM",
id_var = "USUBJID",
saffl_var = "SAFFL",
trtsdtm_var = "TRTSDTM",
trtedtm_var = "TRTEDTM",
u_trtdur = "days",
dcsreas_var = "DCSREAS",
x_lab = paste0("Time from first dose (", u_trtdur, ")"),
y_lab = "Cumulative Incidence (\%)\\nAEs Leading to Treatment\\nDiscontinuation",
xticks = NA,
ggtheme = NULL,
add_table = TRUE,
annotations = NULL
)
}
\arguments{
\item{df}{(\code{data.frame})\cr dataset required to build table.}
\item{arm_var}{(\code{character})\cr Name of the treatment arm variable used to split table into columns.}
\item{id_var}{(\code{character})\cr variable used as unique subject identifier.}
\item{saffl_var}{(\code{character})\cr flag variable used to indicate inclusion in safety population.}
\item{trtsdtm_var}{(\code{character})\cr treatment start datetime variable.}
\item{trtedtm_var}{(\code{character})\cr treatment end datetime variable.}
\item{u_trtdur}{(\code{character})\cr unit for duration of treatment. Options are \code{"days"}, \code{"weeks"}, \code{"months"},
and \code{"years"}.}
\item{dcsreas_var}{(\code{character})\cr reason for treatment discontinuation variable used to split figure into lines.}
\item{x_lab}{(\code{character})\cr x-axis label.}
\item{y_lab}{(\code{character})\cr y-axis label.}
\item{xticks}{(\code{vector} of \code{numeric})\cr x-axis tick positions. If \code{NA} (default), tick mark positions are
automatically calculated.}
\item{ggtheme}{(\code{theme})\cr a graphical theme as provided by \code{ggplot2} to control styling of the \code{ggplot} object.}
\item{add_table}{(\code{flag})\cr whether tables should be printed under the plot.}
\item{annotations}{(named \code{list} of \code{character})\cr list of annotations to add to the figure. Valid annotation types
are \code{title}, \code{subtitles}, and \code{caption}. Each name-value pair should use the annotation type as name and the
desired string as value.}
}
\value{
A \code{ggplot2} object.
}
\description{
FDA Figure 3: Time to Adverse Event Leading to Treatment Discontinuation, Safety Population, Trial X
}
\details{
\itemize{
\item \code{df} must contain the variables specified by \code{arm_var}, \code{id_var}, \code{saffl_var}, \code{trtsdtm_var}, \code{trtedtm_var} and
\code{dcsreas_var}.
\item Flag variables (i.e. \code{XXXFL}) are expected to have two levels: \code{"Y"} (true) and \code{"N"} (false). Missing values in
flag variables are treated as \code{"N"}.
\item It is assumed that every record for a unique patient in \code{df} has the same treatment start and end datetime.
\item Values in the "Number at risk" table are the number of patients at risk for each arm with treatment duration equal
to
or greater than the given time (times corresponding to the figure's x-ticks labels).
\item Values in the "Cumulative Number of Patients with Event" table are the cumulative number of patients given time to
AEs leading to treatment discontinuation for each arm throughout the trial (times corresponding to the figure's
x-ticks labels).
\item Records with missing treatment start and/or end datetime are excluded from all calculations.
}
}
\examples{
adsl <- random.cdisc.data::cadsl
fig <- make_fig_03(df = adsl, dcsreas_var = "DCSREAS")
fig
}