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. Iflen
is a numeric vector of length 2 it will produce vectors with lengths between a minimum and maximum, inclusive. For examplelen = c(1L, 10L)
would produce vectors with lengths between 1 and 10. To produce empty vectors setlen = 0L
or a range likelen = c(0L, 10L)
.- any_na
Whether
NA
values should be allowed.
Examples
any_vector() %>% show_example()
#> [1] -818061997 -458211042 933446051 514832651 0 -281164566 475289924
#> [8] -253693478 -323924961
any_vector(len = 10L, any_na = TRUE) %>% show_example()
#> [[1]]
#> [1] "237-03-23 01:56:48 UTC"
#>
#> [[2]]
#> [1] NA
#>
#> [[3]]
#> 14:23:19.33877
#>
#> [[4]]
#> [1] "2985-11-20 20:52:06 UTC"
#>
#> [[5]]
#> [1] "2294-01-06"
#>
#> [[6]]
#> [1] "731-08-17 14:13:07 UTC"
#>
#> [[7]]
#> [1] 7981
#>
#> [[8]]
#> [1] NA
#>
#> [[9]]
#> [1] 4965
#>
#> [[10]]
#> [1] 618881553
#>