
Query to add a column with the individual birth date
Source:R/addDemographicsQuery.R
addDateOfBirthQuery.Rd
`r lifecycle::badge("experimental")` Same as `addDateOfBirth()`, except query is not computed to a table.
Usage
addDateOfBirthQuery(
x,
dateOfBirthName = "date_of_birth",
missingDay = 1,
missingMonth = 1,
imposeDay = FALSE,
imposeMonth = FALSE
)
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.
Examples
# \donttest{
library(PatientProfiles)
cdm <- mockPatientProfiles()
cdm$cohort1 |>
addDateOfBirthQuery()
#> # Source: SQL [?? x 5]
#> # Database: DuckDB v1.3.1 [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 1 6 1983-01-30 1988-08-25
#> 2 1 2 1933-10-18 1935-04-25
#> 3 3 3 1943-04-29 1948-02-11
#> 4 2 7 1977-12-29 1980-02-06
#> 5 2 5 1945-08-10 1946-12-12
#> 6 1 10 1938-04-29 1958-05-17
#> 7 2 1 1946-07-01 1952-05-09
#> 8 3 8 1992-11-22 1996-10-29
#> 9 3 4 1983-09-24 1984-02-14
#> 10 3 9 1919-01-22 1933-01-30
#> # ℹ 1 more variable: date_of_birth <date>
mockDisconnect(cdm = cdm)
# }