Skip to contents

A set of generators for POSIXct vectors.

Usage

posixct_(len = c(1L, 10L), any_na = FALSE)

posixct_bounded(left, right, len = c(1L, 10L), any_na = FALSE)

posixct_left_bounded(left, len = c(1L, 10L), any_na = FALSE)

posixct_right_bounded(right, len = c(1L, 10L), any_na = FALSE)

Arguments

len

Length of the generated vectors. If len is a single number all vectors will have this length. If len is a numeric vector of length 2 it will produce vectors with lengths between a minimum and maximum, inclusive. For example len = c(1L, 10L) would produce vectors with lengths between 1 and 10. To produce empty vectors set len = 0L or a range like len = 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.

Value

A quickcheck_generator object.

Examples

posixct_() %>% show_example()
#> [1] "692-06-16 08:11:18 UTC"  "1382-07-26 14:31:11 UTC"
#> [3] "959-08-19 17:41:02 UTC"  "1505-01-23 09:29:06 UTC"
#> [5] "2030-12-20 05:28:04 UTC" "753-10-16 05:19:10 UTC" 
#> [7] "127-09-14 16:22:20 UTC"  "1154-06-21 20:09:19 UTC"
#> [9] "688-02-13 18:59:57 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-02-25 16:13:33 UTC"
posixct_(len = 10L, any_na = TRUE) %>% show_example()
#>  [1] "2511-04-30 12:22:36 UTC" NA                       
#>  [3] NA                        "2654-06-27 23:32:41 UTC"
#>  [5] "1849-01-13 19:35:02 UTC" "1641-11-27 06:00:51 UTC"
#>  [7] "2973-09-20 18:35:52 UTC" NA                       
#>  [9] "2208-12-08 09:48:25 UTC" "1147-03-23 18:42:59 UTC"