generators {vroom} | R Documentation |
Generate individual vectors of the types supported by vroom
Description
Generate individual vectors of the types supported by vroom
Usage
gen_character(n, min = 5, max = 25, values = c(letters, LETTERS, 0:9), ...)
gen_double(n, f = stats::rnorm, ...)
gen_number(n, f = stats::rnorm, ...)
gen_integer(n, min = 1L, max = .Machine$integer.max, prob = NULL, ...)
gen_factor(
n,
levels = NULL,
ordered = FALSE,
num_levels = gen_integer(1L, 1L, 25L),
...
)
gen_time(n, min = 0, max = hms::hms(days = 1), fractional = FALSE, ...)
gen_date(n, min = as.Date("2001-01-01"), max = as.Date("2021-01-01"), ...)
gen_datetime(
n,
min = as.POSIXct("2001-01-01"),
max = as.POSIXct("2021-01-01"),
tz = "UTC",
...
)
gen_logical(n, ...)
gen_name(n)
Arguments
n |
The size of the vector to generate |
min |
The minimum range for the vector |
max |
The maximum range for the vector |
values |
The explicit values to use. |
... |
Additional arguments passed to internal generation functions |
f |
The random function to use. |
prob |
a vector of probability weights for obtaining the elements of the vector being sampled. |
levels |
The explicit levels to use, if |
ordered |
Should the factors be ordered factors? |
num_levels |
The number of factor levels to generate |
fractional |
Whether to generate times with fractional seconds |
tz |
The timezone to use for dates |
Examples
# characters
gen_character(4)
# factors
gen_factor(4)
# logical
gen_logical(4)
# numbers
gen_double(4)
gen_integer(4)
# temporal data
gen_time(4)
gen_date(4)
gen_datetime(4)
[Package vroom version 1.6.5 Index]