Usage
addBirthday(
x,
birthday = 0,
birthdayName = "birthday",
ageMissingMonth = 1L,
ageMissingDay = 1L,
ageImposeMonth = FALSE,
ageImposeDay = FALSE,
ageUnit = "years",
name = NULL
)Arguments
- x
A table containing individuals in a CDM reference.
- birthday
Day of birth to add.
- birthdayName
Name of the birthday column to add.
- ageMissingMonth
Month of the year assigned when month of birth is missing.
- ageMissingDay
Day of the month assigned when day of birth is missing.
- ageImposeMonth
If
TRUE, month of birth is treated as missing for all individuals.- ageImposeDay
If
TRUE, day of birth is treated as missing for all individuals.- ageUnit
Unit in which to express age:
"years","months", or"days".- name
Name of the new table. If
NULL, a temporary table is returned.
Examples
# \donttest{
library(PatientProfiles)
library(dplyr)
#>
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#>
#> filter, lag
#> The following objects are masked from ‘package:base’:
#>
#> intersect, setdiff, setequal, union
cdm <- mockPatientProfiles(source = "duckdb")
cdm$cohort1 |>
addBirthday() |>
glimpse()
#> Rows: ??
#> Columns: 5
#> $ cohort_definition_id <int> 1, 2, 2, 3, 1, 2, 1, 2, 1, 3
#> $ subject_id <int> 2, 9, 4, 8, 1, 6, 7, 10, 5, 3
#> $ cohort_start_date <date> 1958-05-20, 1922-03-12, 1919-03-19, 1986-08-19, 1…
#> $ cohort_end_date <date> 1961-06-18, 1924-08-28, 1933-08-09, 2012-07-09, 1…
#> $ birthday <date> 1955-01-01, 1915-01-01, 1916-01-01, 1968-01-01, …
cdm$cohort1 |>
addBirthday(birthday = 5, birthdayName = "bithday_5th") |>
glimpse()
#> Rows: ??
#> Columns: 5
#> $ cohort_definition_id <int> 1, 2, 2, 3, 1, 2, 1, 2, 1, 3
#> $ subject_id <int> 2, 9, 4, 8, 1, 6, 7, 10, 5, 3
#> $ cohort_start_date <date> 1958-05-20, 1922-03-12, 1919-03-19, 1986-08-19, 1…
#> $ cohort_end_date <date> 1961-06-18, 1924-08-28, 1933-08-09, 2012-07-09, 1…
#> $ bithday_5th <date> 1960-01-01, 1920-01-01, 1921-01-01, 1973-01-01, …
# }
