Generate lists in which each element is an atomic scalar of the same class.
Usage
any_flat_homogeneous_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_homogeneous_list() %>% show_example()
#> [[1]]
#> [1] -571712205
#>
#> [[2]]
#> [1] -595348730
#>
#> [[3]]
#> [1] -431006883
#>
#> [[4]]
#> [1] -464258692
#>
#> [[5]]
#> [1] 194009278
#>
any_flat_homogeneous_list(len = 10L, any_na = TRUE) %>% show_example()
#> [[1]]
#> [1] TRUE
#>
#> [[2]]
#> [1] TRUE
#>
#> [[3]]
#> [1] TRUE
#>
#> [[4]]
#> [1] FALSE
#>
#> [[5]]
#> [1] NA
#>
#> [[6]]
#> [1] NA
#>
#> [[7]]
#> [1] NA
#>
#> [[8]]
#> [1] NA
#>
#> [[9]]
#> [1] TRUE
#>
#> [[10]]
#> [1] TRUE
#>