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. 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_atomic() %>% show_example()
#> [1] FALSE TRUE TRUE TRUE FALSE
any_atomic(len = 10L, any_na = TRUE) %>% show_example()
#> [1] NA "961-02-26 14:47:08 UTC"
#> [3] "587-01-03 22:00:00 UTC" "190-12-25 15:23:24 UTC"
#> [5] "2926-08-24 01:52:53 UTC" "2035-02-21 10:17:43 UTC"
#> [7] "587-11-14 06:42:04 UTC" NA
#> [9] "1590-08-21 15:24:53 UTC" NA