
Add the ordinal number of the observation period associated that a given date is in.
Source:R/addObservationPeriodId.R
addObservationPeriodId.RdAdd 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{
library(PatientProfiles)
cdm <- mockPatientProfiles(source = "duckdb")
cdm$cohort1 |>
addObservationPeriodId()
#> # Source: table<og_124_1761733699> [?? x 5]
#> # Database: DuckDB 1.4.1 [unknown@Linux 6.11.0-1018-azure:R 4.5.1/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 3 8 1987-06-01 2009-08-10
#> 2 3 6 1968-11-21 1999-01-22
#> 3 1 2 1966-10-24 1969-02-07
#> 4 2 5 1935-11-20 1940-12-25
#> 5 3 4 1969-12-12 1971-06-26
#> 6 1 9 1999-05-06 1999-07-25
#> 7 3 1 1990-05-14 2001-01-30
#> 8 2 10 1970-07-23 1988-03-25
#> 9 3 7 1922-08-20 1962-10-10
#> 10 1 3 1955-08-17 1958-02-18
#> # ℹ 1 more variable: observation_period_id <int>
# }