Generate lists in which each element is an atomic scalar.
Usage
any_flat_list(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_flat_list() %>% show_example()
#> [[1]]
#> [1] "1873-07-07 20:51:38 UTC"
#>
#> [[2]]
#> [1] "1149-08-01"
#>
#> [[3]]
#> [1] "2265-01-29"
#>
any_flat_list(len = 10L, any_na = TRUE) %>% show_example()
#> [[1]]
#> [1] NA
#>
#> [[2]]
#> [1] "2801-09-25"
#>
#> [[3]]
#> [1] NA
#>
#> [[4]]
#> [1] TRUE
#>
#> [[5]]
#> 18:51:19.50444
#>
#> [[6]]
#> [1] 0
#>
#> [[7]]
#> [1] F<2I\\`3
#> Levels: F<2I\\`3
#>
#> [[8]]
#> 03:49:11.39228
#>
#> [[9]]
#> [1] "{8NVr&"
#>
#> [[10]]
#> [1] "@]:Y@1f0"
#>