Skip to contents

This function is used to summarise the dose table over multiple cohorts.

Usage

summariseTreatmentFromCohort(
  cohort,
  window,
  treatmentCohortName,
  treatmentCohortId = NULL,
  strata = list(),
  indexDate = "cohort_start_date",
  censorDate = NULL,
  combination = FALSE,
  minCellCount = lifecycle::deprecated()
)

Arguments

cohort

Cohort with drug use variables and strata.

window

Window where to summarise the treatments.

treatmentCohortName

Name of a cohort in the cdm that contains the interest treatments.

treatmentCohortId

Cohort definition id of interest from treatmentCohortName.

strata

Stratification list.

indexDate

Variable in x that contains the date to compute the intersection.

censorDate

Whether to censor overlap events at a specific date or a column date of x. If NULL, end of observation will be used.

combination

Whether to include combination treatments.

minCellCount

\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}

Value

A summary of the drug use stratified by cohort_name and strata_name

Examples

# \donttest{
library(DrugUtilisation)

cdm <- mockDrugUtilisation()
cdm$cohort1 |>
  summariseTreatmentFromCohort(
    treatmentCohortName = "cohort2",
    window = list(c(0, 30), c(31, 365))
  )
#>  The following estimates will be computed:
#>  window1_cohort_1: count, percentage
#>  window2_cohort_1: count, percentage
#>  window1_cohort_3: count, percentage
#>  window1_cohort_2: count, percentage
#>  window2_cohort_2: count, percentage
#>  window2_cohort_3: count, percentage
#>  window1_untreated: count, percentage
#>  window2_untreated: count, percentage
#> → Start summary of data, at 2024-07-24 10:28:53.086145
#>  Summary finished, at 2024-07-24 10:28:53.149175
#> # A tibble: 48 × 13
#>    result_id cdm_name group_name  group_level strata_name strata_level
#>        <int> <chr>    <chr>       <chr>       <chr>       <chr>       
#>  1         1 DUS MOCK cohort_name cohort_1    overall     overall     
#>  2         1 DUS MOCK cohort_name cohort_1    overall     overall     
#>  3         1 DUS MOCK cohort_name cohort_1    overall     overall     
#>  4         1 DUS MOCK cohort_name cohort_1    overall     overall     
#>  5         1 DUS MOCK cohort_name cohort_1    overall     overall     
#>  6         1 DUS MOCK cohort_name cohort_1    overall     overall     
#>  7         1 DUS MOCK cohort_name cohort_1    overall     overall     
#>  8         1 DUS MOCK cohort_name cohort_1    overall     overall     
#>  9         1 DUS MOCK cohort_name cohort_1    overall     overall     
#> 10         1 DUS MOCK cohort_name cohort_1    overall     overall     
#> # ℹ 38 more rows
#> # ℹ 7 more variables: variable_name <chr>, variable_level <chr>,
#> #   estimate_name <chr>, estimate_type <chr>, estimate_value <chr>,
#> #   additional_name <chr>, additional_level <chr>
# }