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 [10 x 5]
#> # Database: DuckDB v1.1.2 [unknown@Linux 6.5.0-1025-azure:R 4.4.2/:memory:]
#> cohort_definition_id subject_id cohort_start_date cohort_end_date
#> <int> <int> <date> <date>
#> 1 1 3 1985-10-10 1988-05-17
#> 2 2 7 1917-07-19 1918-04-18
#> 3 3 9 1981-04-20 1983-03-20
#> 4 1 10 1912-03-25 1912-10-07
#> 5 1 5 1948-10-10 1950-04-09
#> 6 3 4 1983-11-17 1984-02-17
#> 7 1 6 1925-05-09 1940-02-16
#> 8 1 2 1960-05-13 1971-08-12
#> 9 2 1 1908-07-14 1925-08-08
#> 10 3 8 1996-03-06 2012-01-08
#> # ℹ 1 more variable: date_of_birth <date>
mockDisconnect(cdm = cdm)
# }