Makes a two-by-two contingency table which takes the visual form:
Outcome | observed | |
Yes | No | |
Treatment | A | B |
Comparator | C | D |
Where A, B, C, and D are the distinct number of subjects satisfying the criteria of each 2x2 cell.
Only observations that have a Treatment value recorded are returned.
Usage
make_two_by_two_(
dat,
event_index,
cell_index,
treatment_var,
treatment_refval,
subjectid_var
)
Arguments
- dat
data.table. The analysis data set.
- event_index
vector of integers that index the rows in
dat
that match the definition of an 'event'. Matching is done via theINDEX_
column indat
.- cell_index
A vector of integers referencing the rows of
dat
(as specified by theINDEX_
column indat
) that match the population to be analyzed. See the "Endpoint Events" vignette in ramnog for more information.- treatment_var
character. The name of the treatment variable in
dat
.- treatment_refval
character. The reference value of the treatment variable in
dat
.- subjectid_var
character. Name of the subject identifier variable in
dat
(default is "USUBJID").