
Query to add a column with the individual birth date
Source:R/addDemographicsQuery.R
addDateOfBirthQuery.RdSame 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
A table containing individuals in a CDM reference.
- dateOfBirthName
Name of the date-of-birth column to add.
- missingDay
Day of the month assigned when day of birth is missing.
- missingMonth
Month of the year assigned when month of birth is missing.
- imposeDay
If
TRUE, day of birth is treated as missing for all individuals.- imposeMonth
If
TRUE, month of birth is treated as missing for all individuals.
Examples
# \donttest{
library(PatientProfiles)
cdm <- mockPatientProfiles(source = "duckdb")
cdm$cohort1 |>
addDateOfBirthQuery()
#> # A query: ?? x 5
#> # Database: DuckDB 1.5.4 [unknown@Linux 6.17.0-1020-azure:R 4.6.1/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 2 3 1949-04-08 1950-12-10
#> 2 3 6 1906-11-17 1923-08-17
#> 3 1 10 1975-10-02 1990-07-04
#> 4 3 5 1946-09-13 1948-03-31
#> 5 1 1 1955-03-12 1960-03-27
#> 6 2 8 2001-08-08 2010-12-15
#> 7 3 4 1936-07-16 1944-12-11
#> 8 1 9 1924-08-04 1936-01-29
#> 9 2 7 1981-11-27 1993-08-24
#> 10 3 2 1925-09-17 1942-07-20
#> # ℹ 1 more variable: date_of_birth <date>
# }