A set of generators for POSIXct 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
posixct_() %>% show_example()
#> [1] "2796-08-18 05:30:47 UTC" "875-03-04 06:08:36 UTC"
#> [3] "57-05-05 01:05:35 UTC" "1479-12-14 14:17:37 UTC"
#> [5] "1670-11-12 04:55:11 UTC" "650-07-13 10:07:09 UTC"
#> [7] "1694-11-05 14:28:59 UTC"
posixct_bounded(
left = as.POSIXct("2020-01-01 00:00:00"),
right = as.POSIXct("2021-01-01 00:00:00")
) %>% show_example()
#> [1] "2020-07-22 14:24:26 UTC" "2020-02-13 14:03:17 UTC"
#> [3] "2020-12-10 11:45:46 UTC" "2020-05-19 18:19:35 UTC"
#> [5] "2020-08-03 23:46:01 UTC" "2020-04-03 12:28:14 UTC"
#> [7] "2020-06-05 10:46:24 UTC" "2020-04-29 07:29:48 UTC"
#> [9] "2020-04-06 00:19:11 UTC" "2020-05-26 19:57:09 UTC"
posixct_(len = 10L, any_na = TRUE) %>% show_example()
#> [1] "576-07-14 09:03:01 UTC" "2785-04-19 21:42:49 UTC"
#> [3] "2123-02-04 16:33:41 UTC" "1176-09-15 14:19:00 UTC"
#> [5] "1445-09-25 04:18:16 UTC" "1710-04-05 10:27:51 UTC"
#> [7] NA "985-08-07 10:39:34 UTC"
#> [9] NA NA