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  ...3  ...4       ...5  ...6       ...7
#>  1:  TRUE 1346-07-02 FALSE FALSE 2854-07-09 FALSE 2097-04-09
#>  2: FALSE 2633-08-25 FALSE  TRUE 1513-01-09  TRUE 1745-06-27
#>  3: FALSE 1936-03-16 FALSE  TRUE 2057-08-03 FALSE 2614-05-01
#>  4: FALSE 2832-01-17 FALSE FALSE 2458-08-01 FALSE 2973-07-31
#>  5: FALSE 1388-04-19 FALSE FALSE 1371-04-03  TRUE 1319-11-19
#>  6: FALSE 2846-09-01 FALSE  TRUE 2752-04-14 FALSE 2556-03-09
#>  7:  TRUE 1631-12-30  TRUE FALSE 1256-06-18 FALSE 2786-12-16
#>  8:  TRUE 2155-11-07  TRUE  TRUE 2293-02-20 FALSE 1732-01-28
#>  9:  TRUE 1249-10-10 FALSE FALSE 1448-01-15 FALSE 2893-05-28
#> 10:  TRUE 1640-04-06  TRUE FALSE 2441-10-05 FALSE 1989-05-30
data.table_of(any_atomic(), rows = 10L, cols = 5L) %>% show_example()
#>      ...1       ...2       ...3  ...4       ...5
#>  1: FALSE 1380-12-10 1721-05-24  2656 2798-06-12
#>  2:  TRUE 1452-09-23 2348-07-29 -1416 2165-01-29
#>  3:  TRUE 1788-04-06 2537-10-17   224 1603-06-21
#>  4:  TRUE 2989-07-02 1457-05-27  9057 2492-01-10
#>  5: FALSE 1144-07-29 1577-09-19 -2300 2899-05-31
#>  6: FALSE 1480-12-31 2682-10-21 -8420 1009-02-20
#>  7: FALSE 2906-03-13 2235-11-14 -8233 2955-11-27
#>  8:  TRUE 2276-09-18 2675-06-27     0 2130-09-16
#>  9: FALSE 1013-04-03 2659-04-24   107 2068-10-16
#> 10: FALSE 2165-11-08 1066-04-02  -730 1307-11-03