
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.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 3 7 1994-10-07 1998-05-02
#> 2 3 9 1988-04-30 1990-01-24
#> 3 3 10 1971-03-30 1977-10-22
#> 4 3 1 1953-06-03 1953-06-24
#> 5 1 6 1941-02-12 1944-06-08
#> 6 1 3 1971-10-10 1972-07-31
#> 7 2 8 1950-07-15 1953-11-08
#> 8 1 4 1918-03-09 1934-11-20
#> 9 1 5 1947-05-04 1952-03-29
#> 10 2 2 1940-03-17 1941-05-15
#> # ℹ 1 more variable: date_of_birth <date>
mockDisconnect(cdm = cdm)
# }