Skip to contents

[Experimental]

Usage

summariseDrugRestart(
  cohort,
  cohortId = NULL,
  switchCohortTable,
  switchCohortId = NULL,
  strata = list(),
  followUpDays = Inf,
  censorDate = NULL,
  incident = TRUE,
  restrictToFirstDiscontinuation = TRUE
)

Arguments

cohort

A cohort_table object.

cohortId

A cohort definition id to restrict by. If NULL, all cohorts will be included.

switchCohortTable

A cohort table in the cdm that contains possible alternative treatments.

switchCohortId

The cohort ids to be used from switchCohortTable. If NULL all cohort definition ids are used.

strata

A list of variables to stratify results. These variables must have been added as additional columns in the cohort table.

followUpDays

A vector of number of days to follow up. It can be multiple values.

censorDate

Name of a column that indicates the date to stop the analysis, if NULL end of individuals observation is used.

incident

Whether the switch treatment has to be incident (start after discontinuation) or not (it can start before the discontinuation and last till after).

restrictToFirstDiscontinuation

Whether to consider only the first discontinuation episode or all of them.

Value

A summarised_result object with the percentages of restart, switch and not exposed per window.

Examples

# \donttest{
library(DrugUtilisation)

cdm <- mockDrugUtilisation()

conceptlist <- list("a" = 1125360, "b" = c(1503297, 1503327))
cdm <- generateDrugUtilisationCohortSet(
  cdm = cdm,
  name = "switch_cohort",
  conceptSet = conceptlist
)
#>  Subsetting drug_exposure table
#>  Checking whether any record needs to be dropped.
#>  Collapsing overlaping records.
#>  Collapsing records with gapEra = 1 days.

result <- cdm$cohort1 |>
  summariseDrugRestart(switchCohortTable = "switch_cohort")

tableDrugRestart(result)
cdm_name
DUS MOCK
cohort_table_name incident switch_cohort_table Treatment estimate_name
cohort_name
cohort_1 cohort_2 cohort_3
Drug restart till end of observation
cohort1 TRUE switch_cohort restart N (%) 0 (0.0 %) 0 (0.0 %) 0 (0.0 %)
cohort1 TRUE switch_cohort switch N (%) 0 (0.0 %) 2 (40.0 %) 0 (0.0 %)
cohort1 TRUE switch_cohort restart and switch N (%) 0 (0.0 %) 0 (0.0 %) 0 (0.0 %)
cohort1 TRUE switch_cohort untreated N (%) 2 (100.0 %) 3 (60.0 %) 3 (100.0 %)
CDMConnector::cdmDisconnect(cdm = cdm) # }