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. 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_list() %>% show_example()
#> [[1]]
#> [1] -884086358
#>
#> [[2]]
#> [1] 881882544
#>
#> [[3]]
#> [1] -491272055
#>
any_list(len = 10L, any_na = TRUE) %>% show_example()
#> [[1]]
#> [[1]]$a
#> [1] "2499-09-20" NA "2952-05-10" "1005-09-11" NA
#> [6] "1108-11-11"
#>
#> [[1]]$b
#> 02:34:50.529544
#> 00:05:44.439508
#> 08:32:19.779608
#>
#>
#> [[2]]
#> [[2]]$a
#> [1] -629545214 -997383408 0 -837441289 NA -365262263 396609275
#> [8] NA -847081338
#>
#> [[2]]$b
#> 07:17:40.806859
#> 23:23:43.045356
#> NA
#>
#>
#> [[3]]
#> [[3]]$a
#> [1] TRUE NA TRUE TRUE
#>
#> [[3]]$b
#> [1] NA TRUE TRUE
#>
#>
#> [[4]]
#> [[4]]$a
#> 10:15:27.442804
#>
#> [[4]]$b
#> [1] 1 1 NA 1
#>
#>
#> [[5]]
#> [[5]]$a
#> [1] 2454
#>
#> [[5]]$b
#> [1] 335453450 -113521002 NA 132472284 NA NA
#> [7] -3222101 -968266140 NA -65043271
#>
#>
#> [[6]]
#> [[6]]$a
#> [1] 1 1 1 1 NA 1 1
#>
#> [[6]]$b
#> [1] 631793426 NA NA -408063327
#>
#>
#> [[7]]
#> [[7]]$a
#> [1] "1335-07-09 01:42:27 UTC" "1579-01-11 14:09:46 UTC"
#> [3] "1324-05-15 23:20:32 UTC" "2338-05-27 06:28:19 UTC"
#> [5] "510-08-23 00:26:29 UTC" "124-06-13 23:00:42 UTC"
#>
#> [[7]]$b
#> 07:30:24.483558
#> 21:27:45.417999
#> 22:53:03.829084
#> NA
#> 14:11:43.342695
#> NA
#> 05:10:03.279430
#> NA
#>
#>
#> [[8]]
#> [[8]]$a
#> [1] 467859636 -595068736 -399317824 -158914861 NA 448554142
#> [7] -198047964 -511100523 -159704710 -354239552
#>
#> [[8]]$b
#> [1] NA -777798024 -93949915 593803027 NA 89391198
#>
#>
#> [[9]]
#> [[9]]$a
#> [1] "1054-03-20 19:25:35 UTC" "2347-11-06 18:56:38 UTC"
#> [3] "630-12-03 12:28:05 UTC"
#>
#> [[9]]$b
#> [1] FALSE TRUE NA NA FALSE NA NA NA TRUE
#>
#>
#> [[10]]
#> [[10]]$a
#> [1] "1957-08-31" "2219-05-03" NA
#>
#> [[10]]$b
#> [1] -5265 7039 -3798 4796 NA
#>
#>