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{
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.
cdm$cohort1 |>
addDrugRestart(switchCohortTable = "switch_cohort")
#> # Source: table<og_046_1734615708> [?? x 5]
#> # Database: DuckDB v1.1.3 [unknown@Linux 6.8.0-1017-azure:R 4.4.2/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 3 1 2018-04-16 2019-06-16
#> 2 3 3 2020-12-01 2021-07-06
#> 3 3 5 2022-12-23 2022-12-23
#> 4 1 10 2004-08-14 2004-08-24
#> 5 2 6 2008-12-28 2009-10-09
#> 6 2 7 2015-03-24 2017-03-20
#> 7 2 8 2019-05-21 2019-12-20
#> 8 3 9 2016-06-24 2017-09-04
#> 9 3 4 2007-09-21 2008-04-09
#> 10 1 2 2019-02-13 2019-02-25
#> # ℹ 1 more variable: drug_restart_inf <chr>
CDMConnector::cdmDisconnect(cdm = cdm)
# }