Add a column with the individual birth date
Usage
addDateOfBirth(
x,
dateOfBirthName = "date_of_birth",
missingDay = 1,
missingMonth = 1,
imposeDay = FALSE,
imposeMonth = FALSE,
name = NULL
)
Arguments
- x
Table in the cdm that contains 'person_id' or 'subject_id'.
- dateOfBirthName
Name of the column to be added with the date of birth.
- missingDay
Day of the individuals with no or imposed day of birth.
- missingMonth
Month of the individuals with no or imposed month of birth.
- imposeDay
Whether to impose day of birth.
- imposeMonth
Whether to impose month of birth.
- name
Name of the new table, if NULL a temporary table is returned.
Examples
# \donttest{
library(PatientProfiles)
cdm <- mockPatientProfiles()
cdm$cohort1 |>
addDateOfBirth()
#> # Source: table<og_090_1750280269> [?? x 5]
#> # Database: DuckDB v1.3.0 [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 2 1 1914-10-20 1920-06-16
#> 2 3 4 1956-12-18 1970-06-19
#> 3 2 7 1964-06-10 1984-03-18
#> 4 3 9 1918-11-07 1929-09-05
#> 5 1 3 1946-07-23 1960-06-05
#> 6 1 6 1971-07-15 1986-12-30
#> 7 2 5 1927-10-04 1931-03-10
#> 8 1 8 1930-05-09 1939-04-16
#> 9 2 2 1960-08-14 1968-03-07
#> 10 2 10 1928-10-24 1940-11-12
#> # ℹ 1 more variable: date_of_birth <date>
mockDisconnect(cdm = cdm)
# }