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

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)
#>   birth_date  dato_pros alder
#> 1 1951-12-30 2021-05-29    69
#> 2 1951-12-30 2021-12-29    69
#> 3 1951-12-30 2021-12-30    70