time_jitter.Rd
Modify a vector of dates by a random quantity in [-e, e]. The distribution decreases exponentially, with rate 1/2
time_jitter(x, e)
x | Numeric or Date vector. |
---|---|
e | Numeric. Semi-width of the jittering interval. |
Vector of the same size and type as x
with jittered
values.
#> [1] 1 2 4 4 5 6 7 7 9 11#> [1] "2019-07-17" "2019-07-19" "2019-07-20" "2019-07-22" "2019-07-22" #> [6] "2019-07-22" "2019-07-25" "2019-07-24" "2019-07-27" "2019-07-28"## Distribution of jittering x <- seq.int(1e3) xj <- spreadrate:::time_jitter(x, 5) barplot(table(x - xj))