Skip to contents

Generate lists containing lists or atomic vectors.

Usage

any_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. If len is a numeric vector of length 2 it will produce vectors with lengths between a minimum and maximum, inclusive. For example len = c(1L, 10L) would produce vectors with lengths between 1 and 10. To produce empty vectors set len = 0L or a range like len = c(0L, 10L).

any_na

Whether NA values should be allowed.

Value

A quickcheck_generator object.

Examples

any_list() %>% show_example()
#> [[1]]
#> [1] "2108-05-15" "2605-07-22" "1566-08-11" "1436-11-24"
#> 
#> [[2]]
#> [1] "1843-04-14 17:15:42 UTC" "2096-03-02 03:32:40 UTC"
#> [3] "2385-03-08 08:46:30 UTC" "2582-01-11 17:10:22 UTC"
#> [5] "2349-03-04 20:18:01 UTC"
#> 
#> [[3]]
#> [1] -3225 -8015     0  1231 -6359 -1512  3383
#> 
#> [[4]]
#> [1] "2842-05-09" "2995-11-23" "2900-06-28" "2727-11-12" "2159-12-05"
#> [6] "1812-05-29" "2916-01-06"
#> 
#> [[5]]
#> [1]  TRUE FALSE  TRUE  TRUE FALSE FALSE FALSE
#> 
#> [[6]]
#> [1] FALSE  TRUE FALSE  TRUE  TRUE FALSE FALSE FALSE  TRUE
#> 
#> [[7]]
#> 08:23:37.556177
#> 18:26:07.145778
#> 21:33:59.611820
#> 
#> [[8]]
#> [1] "1685-09-03" "2579-11-16" "2370-08-28"
#> 
#> [[9]]
#> [1] hlMOff' @a-3tW  }A^C6   TVh"    2z=4   
#> Levels: hlMOff' @a-3tW }A^C6 TVh" 2z=4
#> 
any_list(len = 10L, any_na = TRUE) %>% show_example()
#> [[1]]
#> [[1]]$a
#> [1] h\\2$(0#[
#> Levels: h\\2$(0#[
#> 
#> [[1]]$b
#> 20:18:40.367336
#> 16:22:10.385387
#>              NA
#>              NA
#> 03:06:50.668862
#>              NA
#> 
#> 
#> [[2]]
#> [[2]]$a
#> [1] ".^~a/{F4" ",~e"      "Ff_A}NU"  NA        
#> 
#> [[2]]$b
#> [1]    NA FALSE    NA FALSE FALSE  TRUE FALSE    NA  TRUE
#> 
#> 
#> [[3]]
#> [[3]]$a
#> 03:04:34.039662
#>              NA
#> 04:33:10.532815
#> 11:22:26.590740
#> 01:19:01.872082
#> 17:26:32.341889
#> 
#> [[3]]$b
#> [1] FALSE    NA  TRUE    NA  TRUE  TRUE  TRUE    NA
#> 
#> 
#> [[4]]
#> [[4]]$a
#> [1] TRUE   NA TRUE TRUE   NA TRUE
#> 
#> [[4]]$b
#> NA
#> 
#> 
#> [[5]]
#> [[5]]$a
#> [1]  4526    NA    NA -9351 -9970
#> 
#> [[5]]$b
#> [1]  5916  5183 -2492 -3734     0
#> 
#> 
#> [[6]]
#> [[6]]$a
#>  [1]    NA    NA  3786    NA     0 -8401 -6853    NA    NA    NA
#> 
#> [[6]]$b
#>  [1]  TRUE  TRUE    NA  TRUE  TRUE    NA FALSE  TRUE FALSE  TRUE
#> 
#> 
#> [[7]]
#> [[7]]$a
#> [1] NA         NA         "oD[`"     "\\ovqQRr"
#> 
#> [[7]]$b
#> [1] FALSE    NA
#> 
#> 
#> [[8]]
#> [[8]]$a
#>  [1]    NA -4862  1499     0    NA    NA  2558 -5005 -7239 -7605
#> 
#> [[8]]$b
#> [1] "1531-03-27"
#> 
#> 
#> [[9]]
#> [[9]]$a
#> [1] NA          "\\"        "Z,Wz>f"    "\\jtNH=#N" NA          NA         
#> [7] "&&CK($\\h"
#> 
#> [[9]]$b
#> [1]   NA TRUE TRUE
#> 
#> 
#> [[10]]
#> [[10]]$a
#> [1] NA           "2091-08-22" "1142-05-25" NA           NA          
#> 
#> [[10]]$b
#> [1] -260825642          0         NA  186458631
#> 
#>