Skip to contents

Generate vectors of integer, double, character, logical, date, POSIXct, hms, or factors.

Usage

any_atomic(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.

Value

A quickcheck_generator object.

Examples

any_atomic() %>% show_example()
#> [1] "2909-07-22" "2053-01-23" "2236-06-09" "1628-12-02" "1181-06-13"
#> [6] "1721-06-23" "1348-09-17"
any_atomic(len = 10L, any_na = TRUE) %>% show_example()
#>  [1]  1  1  1 NA NA  1  1 NA NA  1