-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmake_table_04.Rd
98 lines (85 loc) · 4.1 KB
/
make_table_04.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
86
87
88
89
90
91
92
93
94
95
96
97
98
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fda-table_04.R
\name{make_table_04}
\alias{make_table_04}
\title{FDA Table 4: Patient Disposition, Pooled Analyses}
\usage{
make_table_04(
df,
alt_counts_df = NULL,
show_colcounts = TRUE,
arm_var = "ARM",
id_var = "USUBJID",
pop_vars = c("SAFFL"),
lbl_pop_vars = c("Safety population"),
lbl_overall = NULL,
prune_0 = FALSE,
risk_diff = NULL,
annotations = NULL
)
}
\arguments{
\item{df}{(\code{data.frame})\cr dataset required to build table.}
\item{alt_counts_df}{(\code{character})\cr alternative dataset (typically ADSL) used only to calculate column counts.}
\item{show_colcounts}{(\code{flag})\cr Whether column counts should be printed. Boolean.}
\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{pop_vars}{(\code{vector} of \code{character})\cr population variables from \code{df} to include in the table.}
\item{lbl_pop_vars}{(\code{vector} of \code{character})\cr labels corresponding to variables in \code{pop_vars} to print
in the table. Labels should be ordered according to the order of variables in \code{pop_vars}.}
\item{lbl_overall}{(\code{character})\cr if specified, an overall column will be added to the table with
the given value as the column label.}
\item{prune_0}{(\code{flag})\cr Whether all-zero rows should be removed from the table. Boolean.}
\item{risk_diff}{(named \code{list})\cr list of settings to apply to add one or more risk difference columns to the table.
Defaults to \code{NULL} (no risk difference column added). See \code{\link[tern:add_riskdiff]{tern::add_riskdiff()}} for more details. List should
contain the following elements:
\itemize{
\item \code{arm_x}: (required) the name of reference arm.
\item \code{arm_y}: (required) the names of the arms to compare to the reference arm. A new column will be added for each
element of \code{arm_y}.
\item \code{col_label}: (optional) labels to use for the risk difference columns. Defaults to
\code{"Risk Difference (\%) (95\% CI)"}. For more than one risk difference column, \code{"arm x vs. arm y"} text will also
be included in the column labels by default. The length of \code{col_label} must be equal to the length of \code{arm_y}.
\item \code{pct}: (optional) whether the output should be returned as percentages. Defaults to \code{TRUE}.
}}
\item{annotations}{(named \code{list} of \code{character})\cr list of annotations to add to the table. Valid
annotation types are \code{title}, \code{subtitles}, \code{main_footer}, and \code{prov_footer}. Each name-value pair should
use the annotation type as name and the desired string as value.}
}
\value{
An \code{rtable} object.
}
\description{
FDA Table 4: Patient Disposition, Pooled Analyses
}
\details{
\itemize{
\item \code{df} must contain \code{EOTSTT}, \code{DCSREAS}, \code{EOSSTT}, \code{DCSREAS} and the variables specified by \code{arm_var}, \code{id_var},
and \code{pop_vars}.
\item If specified, \code{alt_counts_df} must contain the variable specified by \code{arm_var}, \code{id_var}, and \code{pop_vars}.
\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 Columns are split by arm. Overall population column is excluded by default (see \code{lbl_overall} argument).
\item All-zero rows are not removed by default (see \code{prune_0} argument).
}
}
\examples{
library(dplyr)
adsl <- random.cdisc.data::cadsl \%>\%
mutate(test = rbinom(400, 1, 0.5)) \%>\%
mutate(
RANDFL = ifelse(test == 0, "N", "Y"),
PPROTFL = ifelse(test == 0, "N", "Y"),
DCSREAS = if_else(DCSREAS \%in\% c(
"ADVERSE EVENT", "LACK OF EFFICACY", "PROTOCOL VIOLATION",
"DEATH", "WITHDRAWAL BY PARENT/GUARDIAN"
), DCSREAS, "OTHER")
)
tbl <- make_table_04(
df = adsl, pop_vars = c("RANDFL", "ITTFL", "SAFFL", "PPROTFL"),
lbl_pop_vars = c(
"Patients randomized", "ITT/mITT population", "Safety population", "Per-protocol population"
)
)
tbl
}