Usage
addBirthday(
x,
birthday = 0,
birthdayName = "birthday",
ageMissingMonth = 1L,
ageMissingDay = 1L,
ageImposeMonth = FALSE,
ageImposeDay = FALSE,
name = NULL
)Arguments
- x
Table with individuals in the cdm.
- birthday
Number of birth day.
- birthdayName
Birth day variable name.
- ageMissingMonth
Month of the year assigned to individuals with missing month of birth.
- ageMissingDay
day of the month assigned to individuals with missing day of birth.
- ageImposeMonth
TRUE or FALSE. Whether the month of the date of birth will be considered as missing for all the individuals.
- ageImposeDay
TRUE or FALSE. Whether the day of the date of birth will be considered as missing for all the individuals.
- 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
#> Database: DuckDB 1.5.1 [unknown@Linux 6.17.0-1008-azure:R 4.5.3/:memory:]
#> $ cohort_definition_id <int> 2, 2, 2, 3, 2, 3, 3, 2, 2, 1
#> $ subject_id <int> 4, 3, 8, 9, 7, 1, 10, 2, 5, 6
#> $ cohort_start_date <date> 1946-02-08, 1902-07-12, 1985-12-08, 1963-01-20, 2…
#> $ cohort_end_date <date> 1947-12-07, 1925-10-15, 1992-03-03, 1964-01-31, 2…
#> $ birthday <date> 1932-01-01, 1901-01-01, 1970-01-01, 1955-01-01, …
cdm$cohort1 |>
addBirthday(birthday = 5, birthdayName = "bithday_5th") |>
glimpse()
#> Rows: ??
#> Columns: 5
#> Database: DuckDB 1.5.1 [unknown@Linux 6.17.0-1008-azure:R 4.5.3/:memory:]
#> $ cohort_definition_id <int> 2, 2, 2, 3, 2, 3, 3, 2, 2, 1
#> $ subject_id <int> 4, 3, 8, 9, 7, 1, 10, 2, 5, 6
#> $ cohort_start_date <date> 1946-02-08, 1902-07-12, 1985-12-08, 1963-01-20, 2…
#> $ cohort_end_date <date> 1947-12-07, 1925-10-15, 1992-03-03, 1964-01-31, 2…
#> $ bithday_5th <date> 1937-01-01, 1906-01-01, 1975-01-01, 1960-01-01, …
# }
