ProjectMOSAIC / mosaicData

R package with Project MOSAIC datasets
6 stars 6 forks source link

Some dates are now wrong in Marriage #35

Closed homerhanumat closed 2 years ago

homerhanumat commented 4 years ago

The resolution of Issue #34 resulted in some dates with years well into the 21st century, because, e.g.:

> mdy("12/31/69")  # before UNIX epoch
[1] "1969-12-31"
> mdy("01/01/70")  # UNIX epoch
[1] "1970-01-01"
rpruim commented 2 years ago

This got lost in the shuffle (for awhile). It looks like is the two-digit years for dob that are the issue. I've modified things to subtract 100 year from the dob if dob is after the ceremony date. The date ranges seem reasonable and age + dob = ceremonydate (approximately). So things are looking good.

library(mosaicData)
range(Marriage$appdate)
#> [1] "1996-10-29" "1999-02-05"
range(Marriage$ceremonydate)
#> [1] "1996-11-09" "1999-02-06"
range(Marriage$dob)
#> [1] "1924-05-21" "1982-07-20"

Marriage |>
  ggformula::gf_point( ceremonydate ~ (dob + lubridate::days(round(age * 365.25))))

Created on 2022-08-30 with reprex v2.0.2