
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
Table with individuals in the cdm.
- dateOfBirthName
dateOfBirth column name.
- missingDay
day of the month assigned to individuals with missing day of birth.
- missingMonth
Month of the year assigned to individuals with missing month of birth.
- imposeDay
TRUE or FALSE. Whether the day of the date of birth will be considered as missing for all the individuals.
- imposeMonth
TRUE or FALSE. Whether the month of the date of birth will be considered as missing for all the individuals.
Examples
# \donttest{
library(PatientProfiles)
cdm <- mockPatientProfiles(source = "duckdb")
cdm$cohort1 |>
addDateOfBirthQuery()
#> # Source: SQL [?? x 5]
#> # Database: DuckDB 1.5.1 [unknown@Linux 6.17.0-1008-azure:R 4.5.3/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 1 7 1952-05-17 1978-12-05
#> 2 1 4 1990-01-13 1995-08-10
#> 3 2 2 1965-10-06 1997-09-15
#> 4 3 3 1993-03-17 1995-03-09
#> 5 3 8 1919-08-31 1936-04-13
#> 6 2 9 1981-12-14 1981-12-15
#> 7 3 5 1928-05-20 1928-06-17
#> 8 3 6 1937-03-12 1955-02-21
#> 9 3 1 1972-02-02 1972-03-11
#> 10 3 10 1949-11-12 1952-02-27
#> # ℹ 1 more variable: date_of_birth <date>
# }