Create a Subject History Table by Protocol
Source:R/CreateProtocolHistory.R
CreateProtocolHistory.Rd
Create a Subject History Table by Protocol
Arguments
- start_vec
a named integer vector with the number of days before subject consent when the subject history should start, per protocol
- end_vec
a named integer vector with the length of the study phase of interest, per protocol
- persons_df
Either the name of the data frame that contains all the subject IDs and their clinical trials (which defaults to
"everybody"
), or a data frame with this information. See "Details" for more information.
Value
A tibble with columns who
, project
, and when
.
Each subject will have one row for each day in the study range.
Details
We may want to perform SQL-like operations on a set of tables. This
data table will form the "backbone" for future join operations. It creates
one record per person in each study for each day in those studies (when
persons_df
is set to "everybody"
), or it creates one record
per person contained in the table persons_df
for each day in those
studies. The default behavior is to use the supplied "everybody"
table for all consenting subjects in the CTN-0027, CTN-0030, and CTN-0051
clinical trials. However, users may only care about a smaller subset of
these patients, so a subset of the "everybody"
data frame can be
supplied to the persons_df
argument if desired.
NOTE: this function is only appropriate for trial with fixed start and
end days (such as CTN-0027 or CTN-0051). For studies with variable-length
(i.e., subject-specific) protocol lengths, please use
CreateSubjectProtocolHistory()
instead.
Examples
start_int <- c(`27` = -30L, `51` = -30L)
end_int <- c(`27` = 168L, `51` = 168L)
CreateProtocolHistory(
start_vec = start_int, end_vec = end_int
)
#> # A tibble: 535,708 × 3
#> who project when
#> <int> <chr> <int>
#> 1 8 27 -30
#> 2 8 27 -29
#> 3 8 27 -28
#> 4 8 27 -27
#> 5 8 27 -26
#> 6 8 27 -25
#> 7 8 27 -24
#> 8 8 27 -23
#> 9 8 27 -22
#> 10 8 27 -21
#> # ℹ 535,698 more rows