
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(source = "duckdb")
cdm$cohort1 |>
addDateOfBirthQuery()
#> # Source: SQL [?? x 5]
#> # Database: DuckDB 1.3.3-dev231 [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 7 1905-09-04 1909-06-14
#> 2 3 4 1920-06-08 1932-06-04
#> 3 2 2 1924-08-28 1932-08-21
#> 4 2 6 1916-12-09 1917-04-24
#> 5 1 1 1926-04-15 1926-09-07
#> 6 2 9 1999-07-25 2020-02-18
#> 7 3 10 1959-08-23 1961-06-29
#> 8 2 8 1985-10-11 2003-05-20
#> 9 2 3 1929-10-03 1929-11-27
#> 10 1 5 1913-08-19 1915-02-05
#> # ℹ 1 more variable: date_of_birth <date>
# }