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

View source: R/addBirthDay.R

addBirthdayR Documentation

Add the birth day of an individual to a table

Description

[Experimental]

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

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.

Value

The table with a new column containing the birth day.

Examples


library(PatientProfiles)
library(dplyr)

cdm <- mockPatientProfiles(source = "duckdb")

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

cdm$cohort1 |>
  addBirthday(birthday = 5, birthdayName = "bithday_5th") |>
  glimpse()



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