derive_vars_aage {admiral}R Documentation

Derive Analysis Age

Description

Derives analysis age (AAGE) and analysis age unit (AAGEU)

Usage

derive_vars_aage(
  dataset,
  start_date = BRTHDT,
  end_date = RANDDT,
  unit = "years"
)

Arguments

dataset

Input dataset

The columns specified by the start_date and the end_date parameter are expected.

start_date

The start date

A date or date-time object is expected.

Refer to derive_vars_dt() to impute and derive a date from a date character vector to a date object.

Default: BRTHDT

end_date

The end date

A date or date-time object is expected.

Refer to derive_vars_dt() to impute and derive a date from a date character vector to a date object.

Default: RANDDT

unit

Unit

The age is derived in the specified unit

Default: 'years'

Permitted Values: 'years', 'months', 'weeks', 'days', 'hours', 'minutes', 'seconds'

Details

The age is derived as the integer part of the duration from start to end date in the specified unit. When 'years' or 'months' are specified in the out_unit parameter, because of the underlying lubridate::time_length() function that is used here, results are calculated based on the actual calendar length of months or years rather than assuming equal days every month (30.4375 days) or every year (365.25 days).

Value

The input dataset with AAGE and AAGEU added

Author(s)

Stefan Bundfuss

See Also

derive_vars_duration()

ADSL Functions that returns variable appended to dataset: derive_var_age_years(), derive_var_disposition_status(), derive_var_dthcaus(), derive_var_extreme_dtm(), derive_var_extreme_dt(), derive_vars_disposition_reason()

Examples

data <- tibble::tribble(
  ~BRTHDT, ~RANDDT,
  lubridate::ymd("1984-09-06"), lubridate::ymd("2020-02-24")
)

derive_vars_aage(data)

[Package admiral version 0.8.4 Index]