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_131_1730219860> [10 x 5]
#> # Database: DuckDB v1.1.1 [unknown@Linux 6.5.0-1025-azure:R 4.4.1/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 1 7 1963-09-01 1970-06-15
#> 2 3 4 1967-10-29 1982-02-25
#> 3 3 9 1969-04-02 2003-01-13
#> 4 2 2 1988-03-12 1989-06-19
#> 5 1 5 1914-06-18 1915-06-05
#> 6 3 10 1967-11-15 1985-06-29
#> 7 1 3 1919-09-25 1945-11-26
#> 8 3 1 1978-01-28 1979-09-11
#> 9 3 8 1949-04-18 1952-07-19
#> 10 2 6 1941-09-17 1952-02-12
#> # ℹ 1 more variable: observation_period_id <int>
mockDisconnect(cdm = cdm)
# }