Skip to contents

[Questioning] This is an experimental function that may be developed over time.

This function calculates the subjects counts excluded and included for each step of the cohort selection process.

Usage

get_attrition(data, criteria_descriptions, criteria_conditions,
subject_column_name)

Arguments

data

Dataframe. It is used as the input data to count the subjects that meets the criteria of interest

criteria_descriptions

character It contains the descriptions of the inclusion/exclusion criteria. Each element of the vector corresponds to the description of each criterion.

criteria_conditions

character It contains the corresponding conditions of the criteria. These conditions will be used in the table to compute the counts of the subjects.

subject_column_name

character The column name of the table that contains the subject id.

Value

The counts and percentages of the remaining and excluded subjects for each step of the cohort selection in a table format.

Details

criteria_descriptions and criteria_conditions need to be of same length

Examples

visR::get_attrition(adtte,
  criteria_descriptions =
    c(
      "1. Placebo Group", "2. Be 75 years of age or older.",
      "3. White", "4. Site 709"
    ),
  criteria_conditions = c(
    "TRTP=='Placebo'", "AGE>=75",
    "RACE=='WHITE'", "SITEID==709"
  ),
  subject_column_name = "USUBJID"
)
#> # A tibble: 5 × 6
#>   Criteria       Condition `Remaining N` `Remaining %` `Excluded N` `Excluded %`
#>   <chr>          <chr>             <int>         <dbl>        <int>        <dbl>
#> 1 Total cohort … none                254        100               0         0   
#> 2 1. Placebo Gr… TRTP=='P…            86         33.9           168        66.1 
#> 3 2. Be 75 year… AGE>=75              48         18.9            38        15.0 
#> 4 3. White       RACE=='W…            45         17.7             3         1.18
#> 5 4. Site 709    SITEID==…             3          1.18           42        16.5