Skip to contents

Get the base_date add a random number of days taken from a uniform distribution bounded by -max_delta and max_delta. Insure the resulting date is as least as large as the min_date.

Usage

obfuscateDate(baseDate, minDate, maxDelta = 30L)

Arguments

baseDate

list of Date objects with dates to be obfuscated

minDate

list object of Date objects that has the lower bound of resulting obfuscated dates

maxDelta

integer vector that is used to create min and max arguments to runif (runif(n, min = 0, max = 1))

Value

A vector of dates that have be obfuscated.

Examples

library(nprcgenekeepr)
someDates <- rep(
  as.Date(c("2009-2-16", "2016-2-16"), format = "%Y-%m-%d"),
  10
)
minBirthDate <- rep(as.Date("2009-2-16", format = "%Y-%m-%d"), 20)
obfuscateDate(someDates, minBirthDate, 30L)
#>  [1] "2009-03-13" "2016-02-21" "2009-03-16" "2016-02-29" "2009-02-28"
#>  [6] "2016-01-23" "2009-02-24" "2016-03-16" "2009-03-03" "2016-02-13"
#> [11] "2009-02-16" "2016-01-29" "2009-02-21" "2016-02-20" "2009-02-24"
#> [16] "2016-03-12" "2009-02-21" "2016-02-19" "2009-02-17" "2016-03-16"