derive_vars_aage: Derive Analysis Age

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/derive_vars_aage.R

Description

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

Usage

1
2
3
4
5
6
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.

Default: BRTHDT

end_date

The end date

A date or date-time object is expected.

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.

Value

The input dataset with AAGE and AAGEU added

Author(s)

Stefan Bundfuss

See Also

derive_vars_duration()

Examples

1
2
3
4
5
6
data <- tibble::tribble(
  ~BRTHDT, ~RANDDT,
  lubridate::ymd("1984-09-06"), lubridate::ymd("2020-02-24")
)

derive_vars_aage(data)

epijim/admiral documentation built on Feb. 13, 2022, 12:15 a.m.