A set of generators for date vectors.
Arguments
- len
Length of the generated vectors. If
len
is a single number all vectors will have this length. Iflen
is a numeric vector of length 2 it will produce vectors with lengths between a minimum and maximum, inclusive. For examplelen = c(1L, 10L)
would produce vectors with lengths between 1 and 10. To produce empty vectors setlen = 0L
or a range likelen = c(0L, 10L)
.- any_na
Whether
NA
values should be allowed.- left
The minimum possible value for generated numbers, inclusive.
- right
The maximum possible value for generated numbers, inclusive.
Examples
date_() %>% show_example()
#> [1] "1473-08-29" "1254-07-21" "2448-08-02" "1336-04-12" "1283-05-12"
#> [6] "2168-09-01"
date_bounded(
left = as.Date("2020-01-01"),
right = as.Date("2020-01-10")
) %>% show_example()
#> [1] "2020-01-04" "2020-01-01" "2020-01-01" "2020-01-03" "2020-01-07"
date_(len = 10L, any_na = TRUE) %>% show_example()
#> [1] "2373-05-16" "1669-02-03" NA "1865-01-30" NA
#> [6] "2887-02-04" NA NA "1075-06-27" "2377-09-03"