Skip to contents

A set of generators for hms vectors.

Usage

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

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

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

hms_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

hms_() %>% show_example()
#> 23:30:08.301169
#> 18:35:37.631957
hms_bounded(
  left = hms::as_hms("00:00:00"),
  right = hms::as_hms("12:00:00")
) %>% show_example()
#> 07:03:00.243728
#> 03:02:12.006305
#> 03:42:25.124698
#> 04:35:22.816917
#> 04:56:36.718125
#> 02:23:58.039427
#> 06:00:29.415692
#> 05:29:00.445834
#> 10:42:21.357244
#> 09:13:01.564168
hms_(len = 10L, any_na = TRUE) %>% show_example()
#> 06:21:21.207437
#> 20:42:18.392880
#> 14:03:15.997426
#>              NA
#> 17:31:33.662637
#> 04:27:16.567437
#>              NA
#> 12:29:44.878704
#> 17:11:49.684513
#>              NA