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] TRUE
#>
#> [[2]]
#> [1] 0
#>
#> [[3]]
#> [1] "2048-08-10 11:06:12 UTC"
#>
#> [[4]]
#> [1] "1395-01-09"
#>
#> [[5]]
#> [1] -322334493
#>
#> [[6]]
#> [1] "280-01-31 10:55:56 UTC"
#>
#> [[7]]
#> [1] U%vP1)mg
#> Levels: U%vP1)mg
#>
any_flat_list(len = 10L, any_na = TRUE) %>% show_example()
#> [[1]]
#> [1] NA
#>
#> [[2]]
#> [1] NA
#>
#> [[3]]
#> [1] d&aL
#> Levels: d&aL
#>
#> [[4]]
#> [1] NA
#>
#> [[5]]
#> [1] -741
#>
#> [[6]]
#> [1] U`0oe?U?7
#> Levels: U`0oe?U?7
#>
#> [[7]]
#> [1] #Bm
#> Levels: #Bm
#>
#> [[8]]
#> [1] -412003795
#>
#> [[9]]
#> [1] "2453-10-09 20:41:36 UTC"
#>
#> [[10]]
#> [1] "1172-01-29"
#>