Datasets configuration can be
provided in a yaml
file or as a nested list. Below you can
find a detailed description of possible options.
A single YAML file can include multiple data frames. Entry for each will be used as name of the data frame when it comes to generating data.
Data frame configuration includes two sections:
columns
- where you can describe columns of your data
frame.default_size
- optional value that describes default
size of the data frame.Each column of your data frame should be described in a separate entry in columns section. Entry name will be used as column name.
Currently there are three major types of columns implemented:
Type of column is set by choosing a proper type
value in
column description. Check following sections for more details.
The order of columns will be the same as the order of entries in the configuration.
Basic column types. For an example YAML configuration check this
Random integers from a range
Parameters:
type: integer
- column typeunique
(optional, default: FALSE) - boolean, should
values be uniquemin
(optional, default: 0) - integer, minimum value to
occur in the column.max
(optional, default: 999999) - integer, maximum
value to occur in the column.Example:
Random float numbers from a range
Parameters:
type: numeric
- column typeunique
(optional, default: FALSE) - boolean, should
values be uniquemin
(optional, default: 0) - numeric, minimum value to
occur in the column.max
(optional, default: 999999) - numeric, maximum
value to occur in the column.Example:
Random string that follows given pattern
Parameters:
type: string
- column typeunique
(optional, default: FALSE) - boolean, should
values be uniquelength
(optional, default: NULL) - integer, string
length. If NULL, string length will be random (see next
parameters).min_length
(optional, default: 1) - integer, minimum
length if length is random.max_length
(optional, default: 15) - integer, maximum
length if length is random.pattern
(optional, default: “[A-Za-z0-9]”) - string
pattern, for details check this.Example:
Random boolean
Parameters:
type: boolean
- column typeExample:
Column with elements from a set
Parameters:
type: set
- column typeset
(optional, default: NULL) - set of possible values,
if NULL, will use a random set.set_type
(optional, default: NULL) - type of random
set, can be “integer”, “numeric” or “string”.set_size
(optional, default: NULL) - integer, size of
random setExample:
Column with dates
Parameters:
type: date
- column typemin_date
- beginning of the time interval to sample
frommax_date
- end of the time interval to sample fromformat
(optional, default: NULL) - date format, for
details check thisExample:
Column with times
Parameters:
type: time
- column typemin_time
(optional, default: “00:00:00”) - beginning of
the time interval to sample frommax_time
(optional, default: “23:59:59”) - end of the
time interval to sample fromresolution
(optional, default: “seconds”) - one of
“seconds”, “minutes”, “hours”, time resolutionExample:
Column with datetimes
Parameters:
type: datetime
- column typemin_date
- beginning of the time interval to sample
frommax_date
- end of the time interval to sample fromdate_format
(optional, default: NULL) - date format,
for details check thismin_time
(optional, default: “00:00:00”) - beginning of
the time interval to sample frommax_time
(optional, default: “23:59:59”) - end of the
time interval to sample fromtime_resolution
(optional, default: “seconds”) - one of
“seconds”, “minutes”, “hours”, time resolutiontz
(optional, default: “UTC”) - time zone nameExample:
Special predefined types of columns. For an example YAML configuration check this
Id column - ordered integer that starts from defined value (default: 1).
Parameters:
type: id
- column typestart
(optional, default: 1) - first valueExample:
Column filled with values that follow given statistical distribution.
You can use one of the distributions available here.
You can use function name (e.g. rnorm
) or regular
distribution name (e.g. “Normal”). For available names, check this
file.
Parameters:
type: distribution
- column typedistribution_type
- distribution name...
- all arguments required by distribution
functionExample:
data_frame:
columns:
normal_distribution:
type: distribution
distribution_type: Gaussian
bernoulli_distribution:
type: distribution
distribution_type: binomial
size: 1
prob: 0.5
poisson_distribution:
type: distribution
distribution_type: Poisson
lambda: 3
beta_distribution:
type: distribution
distribution_type: rbeta
shape1: 20
shape2: 30
cauchy_distribution:
type: distribution
distribution_type: Cauchy-Lorentz
There are two levels of custom generator that can be used. You can provide a function that generates a single value or a function that provides a whole column. For examples check this configuration and this R script with functions.
Generate column values using custom function available in your environment. Function should return a single value.
Parameters:
type: custom
- column typecustom_generator
- name of the function that will
provide values.Example:
Generate column using custom function available in your environment.
Function should accept argument size
and return a vector of
length equal to it.
Parameters:
type: custom_column
- column typecustom_column_generator
- name of the function that
will generate column.size
.Example:
Calculate columns that depend on other columns. For examples check this configuration and this R script with functions.
Parameters:
type: calculated
- column typeformula
- calculation that has to be performed to
obtain columnIn general, formula can be a simple expression or a call of more complex function. In both cases formula has to include names of the columns required for the calculations. When using a function, make sure that it returns a vector of the same size as inputs.
Example:
Data frame can have a default number of rows that will be returned if size argument is not provided. Default size can be one of:
Example:
random_integer
function. Result can be a static value (if
static: TRUE
provided) or a random number generator. The
first one will generate a number of rows just once ant that number will
be used when data is refreshed (without providing a specific size).Example:
random_number_of_rows:
columns:
...
default_size:
arguments:
min: 10
max: 20
static_random_number_of_rows:
columns:
...
default_size:
arguments:
min: 5
max: 10
static: TRUE
For sample YAML configuration check this.