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()
#> 20:40:00.121523
#> 07:44:44.086629
#> 06:34:52.372687
#> 17:29:14.394315
#> 17:59:52.447400
#> 20:37:01.483059
#> 08:32:12.427268
hms_bounded(
  left = hms::as_hms("00:00:00"),
  right = hms::as_hms("12:00:00")
) %>% show_example()
#> 04:26:38.187375
#> 01:26:13.077071
hms_(len = 10L, any_na = TRUE) %>% show_example()
#> 03:27:06.631576
#>              NA
#> 22:09:13.556434
#> 06:49:00.965746
#>              NA
#> 13:29:11.194667
#> 08:31:48.687016
#> 12:31:19.246663
#> 21:14:01.588410
#>              NA