Part of Pedigree Curation
Details
Given two dates, one is selected to be returned based on whether
it occurred earlier or later than the other. NAs
are ignored if
possible.
Examples
library(nprcgenekeepr)
someDates <- lubridate::mdy(paste0(sample(1:12, 2, replace = TRUE), "-",
sample(1:28, 2, replace = TRUE), "-",
sample(seq(0, 15, by = 3), 2,
replace = TRUE) + 2000))
someDates
#> [1] "2015-03-11" "2015-06-12"
chooseDate(someDates[1], someDates[2], earlier = TRUE)
#> [1] "2015-03-11"
chooseDate(someDates[1], someDates[2], earlier = FALSE)
#> [1] "2015-06-12"