Add a column with the individual birth date
Usage
addDateOfBirth(
x,
dateOfBirthName = "date_of_birth",
missingDay = 1,
missingMonth = 1,
imposeDay = FALSE,
imposeMonth = FALSE,
name = NULL
)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.- name
Name of the new table. If
NULL, a temporary table is returned.
Examples
# \donttest{
library(PatientProfiles)
cdm <- mockPatientProfiles(source = "duckdb")
cdm$cohort1 |>
addDateOfBirth()
#> # 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 5 1929-05-15 1935-11-14
#> 2 3 3 1955-10-29 1970-01-07
#> 3 2 8 1928-11-28 1940-03-19
#> 4 3 9 1976-11-15 1987-11-27
#> 5 2 10 1956-03-15 1956-04-06
#> 6 1 6 1981-12-07 1986-08-29
#> 7 1 2 1942-05-01 1943-04-23
#> 8 3 4 1949-03-25 1969-01-02
#> 9 3 7 1969-05-23 1971-09-03
#> 10 1 1 1971-07-28 1981-09-19
#> # ℹ 1 more variable: date_of_birth <date>
# }
