addAgeQuery: Query to add the age of the individuals at a certain date

View source: R/addDemographicsQuery.R

addAgeQueryR Documentation

Query to add the age of the individuals at a certain date

Description

'r lifecycle::badge("experimental")' Same as 'addAge()', except query is not computed to a table.

Usage

addAgeQuery(
  x,
  indexDate = "cohort_start_date",
  ageName = "age",
  ageGroup = NULL,
  ageMissingMonth = 1,
  ageMissingDay = 1,
  ageImposeMonth = FALSE,
  ageImposeDay = FALSE,
  missingAgeGroupValue = "None"
)

Arguments

x

Table with individuals in the cdm.

indexDate

Variable in x that contains the date to compute the age.

ageName

Name of the new column that contains age.

ageGroup

List of age groups to be added.

ageMissingMonth

Month of the year assigned to individuals with missing month of birth. By default: 1.

ageMissingDay

day of the month assigned to individuals with missing day of birth. By default: 1.

ageImposeMonth

Whether the month of the date of birth will be considered as missing for all the individuals.

ageImposeDay

Whether the day of the date of birth will be considered as missing for all the individuals.

missingAgeGroupValue

Value to include if missing age.

Value

tibble with the age column added.

Examples


cdm <- mockPatientProfiles()

cdm$cohort1 |>
  addAgeQuery()
mockDisconnect(cdm = cdm)


PatientProfiles documentation built on Oct. 30, 2024, 9:13 a.m.