utlede_alder: Add variable age (alder)

View source: R/utlede_variabler.R

utlede_alderR Documentation

Add variable age (alder)

Description

Age in years at time of procedure. Calculated from variables birth_date and dato_pros.

Usage

utlede_alder(df)

Arguments

df

data.frame with AblaNor data. Must contain variables birth_date and dato_pros

Value

Returns df with one new variable: alder (= age in years)

Examples

x <- data.frame(
   birth_date = as.Date(rep("1951-12-30",3), format = "%Y-%m-%d"),
   dato_pros = as.Date(c("2021-05-29", "2021-12-29", "2021-12-30"),
   format = "%Y-%m-%d"))
ablanor::utlede_alder(x)

Rapporteket/ablanor documentation built on Feb. 27, 2025, 8:26 p.m.