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_092_1740755697> [?? x 5]
#> # Database: DuckDB v1.2.0 [unknown@Linux 6.8.0-1021-azure:R 4.4.2/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 1 3 1998-09-07 1999-07-10
#> 2 1 1 1965-12-28 1975-04-13
#> 3 1 7 1982-10-30 1987-03-24
#> 4 2 5 1982-08-28 1983-01-31
#> 5 3 4 1952-03-31 1953-05-28
#> 6 1 2 1921-06-07 1950-10-02
#> 7 1 6 1957-12-09 1959-11-04
#> 8 3 8 1961-03-27 1984-03-18
#> 9 3 9 2002-12-29 2004-12-11
#> 10 2 10 1973-11-10 1974-08-01
#> # ℹ 1 more variable: date_of_birth <date>
mockDisconnect(cdm = cdm)
# }