Похоже, что у eeptools есть функция age_calc()
.
your_data <- data.frame(stringsAsFactors=FALSE,
Born = c("1946-05-27", "1979-06-19", "1980-04-18", "1958-06-12",
"1948-03-23", "1973-07-24", "1949-09-15", "1950-03-12",
"1952-04-20", "1950-06-20"),
bioguide = c("A000370", "A000371", "A000367", "A000369", "B001291",
"B000213", "B001281", "B001271", "B001292", "B001293")
)
library(eeptools)
#> Loading required package: ggplot2
your_data$age <- eeptools::age_calc(dob = as.Date(your_data$Born),
enddate = Sys.Date(),
units = 'years')
your_data
#> Born bioguide age
#> 1 1946-05-27 A000370 73.62459
#> 2 1979-06-19 A000371 40.56158
#> 3 1980-04-18 A000367 39.73224
#> 4 1958-06-12 A000369 61.58075
#> 5 1948-03-23 B001291 71.80328
#> 6 1973-07-24 B000213 46.46569
#> 7 1949-09-15 B001281 70.32048
#> 8 1950-03-12 B001271 69.83281
#> 9 1952-04-20 B001292 67.72678
#> 10 1950-06-20 B001293 69.55884
Создано в 2020-01-10 пакетом Представить (v0.3.0)
Подробнее о eeptools здесь: https://github.com/jknowles/eeptools