gen_tbl | R Documentation |
This is useful for benchmarking, but also for bug reports when you cannot share the real dataset.
gen_tbl(
rows,
cols = NULL,
col_types = NULL,
locale = default_locale(),
missing = 0
)
rows |
Number of rows to generate |
cols |
Number of columns to generate, if |
col_types |
One of If Column specifications created by Alternatively, you can use a compact string representation where each character represents one column:
|
locale |
The locale controls defaults that vary from place to place.
The default locale is US-centric (like R), but you can use
|
missing |
The percentage (from 0 to 1) of missing data to use |
There is also a family of functions to generate individual vectors of each type.
generators to generate individual vectors.
# random 10 x 5 table with random column types
rand_tbl <- gen_tbl(10, 5)
rand_tbl
# all double 25 x 4 table
dbl_tbl <- gen_tbl(25, 4, col_types = "dddd")
dbl_tbl
# Use the dots in long form column types to change the random function and options
types <- rep(times = 4, list(col_double(f = stats::runif, min = -10, max = 25)))
types
dbl_tbl2 <- gen_tbl(25, 4, col_types = types)
dbl_tbl2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.