
Add the ordinal number of the observation period associated that a given date is in.
Source:R/addObservationPeriodId.R
addObservationPeriodId.Rd
Add the ordinal number of the observation period associated that a given date is in.
Usage
addObservationPeriodId(
x,
indexDate = "cohort_start_date",
nameObservationPeriodId = "observation_period_id",
name = NULL
)
Examples
# \donttest{
cdm <- mockPatientProfiles()
cdm$cohort1 |>
addObservationPeriodId()
#> # Source: table<og_118_1752061299> [?? x 5]
#> # Database: DuckDB v1.3.1 [unknown@Linux 6.11.0-1015-azure:R 4.5.1/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 1 4 1970-05-25 1974-04-12
#> 2 1 2 1961-08-10 1992-12-26
#> 3 1 6 1943-11-08 1955-09-30
#> 4 2 10 1986-09-04 1993-07-04
#> 5 3 1 1998-03-29 1998-04-24
#> 6 3 5 1944-06-16 1946-01-18
#> 7 2 8 1929-07-09 1930-04-11
#> 8 1 9 1982-10-04 1983-04-21
#> 9 2 3 1929-08-19 1936-05-01
#> 10 1 7 1966-02-28 1967-01-22
#> # ℹ 1 more variable: observation_period_id <int>
mockDisconnect(cdm = cdm)
# }