addBirthdayQuery: Add the birth day of an individual to a table

View source: R/addBirthDay.R

addBirthdayQueryR Documentation

Add the birth day of an individual to a table

Description

[Experimental] Same as addBirthday(), except query is not computed to a table.

The function accounts for leap years and corrects the invalid dates to the next valid date.

Usage

addBirthdayQuery(
  x,
  birthdayName = "birthday",
  birthday = 0,
  ageMissingMonth = 1,
  ageMissingDay = 1,
  ageImposeMonth = FALSE,
  ageImposeDay = FALSE,
  ageUnit = "years"
)

Arguments

x

A table containing individuals in a CDM reference.

birthdayName

Name of the birthday column to add.

birthday

Day of birth 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".

Value

The table with a query that add the new column containing the birth day.

Examples


library(PatientProfiles)
library(dplyr)

cdm <- mockPatientProfiles(source = "duckdb")

cdm$cohort1 |>
  addBirthdayQuery() |>
  glimpse()

cdm$cohort1 |>
  addBirthdayQuery(birthday = 5) |>
  glimpse()



PatientProfiles documentation built on Aug. 22, 2026, 1:07 a.m.