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(source = "duckdb")
cdm$cohort1 |>
addDateOfBirth()
#> # Source: table<og_091_1759414069> [?? x 5]
#> # Database: DuckDB 1.4.0 [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 1 3 1940-06-15 1950-04-22
#> 2 2 8 1924-04-14 1963-03-02
#> 3 2 10 1914-03-22 1915-02-26
#> 4 3 9 1954-06-15 1959-01-07
#> 5 1 5 1918-02-14 1918-08-27
#> 6 3 6 1962-02-02 1963-03-04
#> 7 3 2 1994-08-04 1999-02-09
#> 8 1 1 1906-01-02 1915-03-19
#> 9 3 4 1945-12-27 1962-11-13
#> 10 2 7 1912-12-01 1923-04-04
#> # ℹ 1 more variable: date_of_birth <date>
# }