
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.2 [unknown@Linux 6.11.0-1015-azure:R 4.5.0/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 3 2 1964-07-29 1973-09-11
#> 2 1 1 1961-09-30 1965-04-12
#> 3 3 7 1961-07-12 1967-11-03
#> 4 1 6 1959-02-12 1960-09-03
#> 5 3 10 1912-04-08 1948-04-02
#> 6 3 8 1943-08-21 1948-01-18
#> 7 3 9 1970-12-13 1979-12-25
#> 8 2 4 1988-05-20 1991-01-19
#> 9 1 5 1985-01-18 1993-10-08
#> 10 3 3 1972-10-27 1978-09-21
#> # ℹ 1 more variable: date_of_birth <date>
mockDisconnect(cdm = cdm)
# }