Skip to contents

data.table generator with randomized columns

Usage

data.table_of(..., rows = c(1L, 10L), cols = c(1L, 10L))

Arguments

...

A set of unnamed generators. The generated data.tables will be built with random combinations of these generators.

rows

Number of rows of the generated data frame. If rows is a single number all data frames will have this number of rows. If rows is a numeric vector of length 2 it will produce data frames with rows between a minimum and maximum, inclusive. For example rows = c(1L, 10L) would produce data frames with rows between 1 and 10. To produce empty tibbles set rows = 0L or a range like rows = c(0L, 10L).

cols

Number of columns of the generated data frame. If cols is a single number all data frames will have this number of columns. If cols is a numeric vector of length 2 it will produce data frames with columns between a minimum and maximum, inclusive. For example cols = c(1L, 10L) would produce data frames with columns between 1 and 10. To produce empty tibbles set cols = 0L or a range like cols = c(0L, 10L).

Value

A quickcheck_generator object.

Examples

data.table_of(logical_(), date_()) %>% show_example()
#>      ...1       ...2
#>    <lgcl>     <Date>
#> 1:  FALSE 2736-05-21
#> 2:  FALSE 1402-12-13
#> 3:   TRUE 2165-04-10
#> 4:   TRUE 2861-05-18
#> 5:  FALSE 1254-12-07
data.table_of(any_atomic(), rows = 10L, cols = 5L) %>% show_example()
#>         ...1      ...2   ...3       ...4  ...5
#>       <char>    <fctr> <lgcl>      <num> <int>
#>  1:       c'       tcS   TRUE  743837357 -6400
#>  2:   +N]&n_     EQz+Z   TRUE -276399987     0
#>  3:       }#    ejE'")  FALSE  953490380  4038
#>  4:       #*   ^w6`Jj2   TRUE          0    46
#>  5:  dNF!%3/      Z~z6   TRUE          0 -2748
#>  6:      4N8      h 4V   TRUE   36600400  1903
#>  7:   _MC1m-         M  FALSE  712263728  4392
#>  8: _h`qB=\\        P$  FALSE -936497377   440
#>  9: oo)j9Se`        5S  FALSE -997568300  8066
#> 10:        + N6PL?)5gS  FALSE -494893717 -2018