Summarise the drug restart per window.
Usage
addDrugRestart(
cohort,
switchCohortTable,
switchCohortId = NULL,
followUpDays = Inf,
censorDate = NULL,
incident = TRUE,
nameStyle = "drug_restart_{follow_up_days}"
)
Arguments
- cohort
A cohort_table object.
- 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.
- 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).
- nameStyle
Character string to specify the nameStyle of the new columns.
Value
A summarised_result object with the percentages of restart, switch and not exposed per window.
Examples
# \donttest{
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.
cdm$cohort1 |>
addDrugRestart(switchCohortTable = "switch_cohort")
#> # Source: table<og_042_1743086309> [?? x 5]
#> # Database: DuckDB v1.2.1 [unknown@Linux 6.8.0-1021-azure:R 4.4.3/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 2 2 2021-09-29 2021-10-13
#> 2 1 1 1993-04-03 2012-05-08
#> 3 3 5 2021-11-21 2021-11-21
#> 4 2 6 2018-06-22 2018-08-09
#> 5 1 10 2020-06-08 2020-06-20
#> 6 1 3 2021-12-19 2022-01-01
#> 7 2 8 2000-07-07 2003-10-07
#> 8 1 9 2014-01-17 2014-04-24
#> 9 1 4 2005-09-23 2005-12-27
#> 10 2 7 2020-05-11 2020-08-02
#> # ℹ 1 more variable: drug_restart_inf <chr>
# }