Skip to contents

Generate atomic vectors or lists.

Usage

any_vector(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_vector() %>% show_example()
#> [1] "1842-11-21 19:47:56 UTC" "2267-05-23 09:45:43 UTC"
#> [3] "2293-02-08 04:25:38 UTC" "1885-03-13 02:32:40 UTC"
#> [5] "978-03-11 19:36:29 UTC"  "2755-06-27 17:00:24 UTC"
#> [7] "1256-02-27 02:37:33 UTC"
any_vector(len = 10L, any_na = TRUE) %>% show_example()
#> [[1]]
#> [1] ":^_q/euI"
#> 
#> [[2]]
#> [1] NA
#> 
#> [[3]]
#> [1] "nGu"
#> 
#> [[4]]
#> [1] NA
#> 
#> [[5]]
#> [1] ")O%DBZV3"
#> 
#> [[6]]
#> [1] NA
#> 
#> [[7]]
#> [1] "it/%5 }"
#> 
#> [[8]]
#> [1] " z)|l"
#> 
#> [[9]]
#> [1] "Gh2jO<%>c"
#> 
#> [[10]]
#> [1] "V 1da{JWk"
#>