Generate a random data frame from given configuration
random_data_frame(configuration, size)
list, a configuration of columns with all arguments required by vector generator passed as sublists of sublist "columns". Column can be also generated with custom function. Pass "custom_column" as column type and function (or function name) as custom_column_generator. Column generator has to accept argument size and return a vector of this size. Third option is to pass an expression that involves existing columns. This can be a simple one, or a call of an existing function.
integer, number of rows to generate.
data.frame
conf <- list(
columns = list(
first_column = list(
type = "string",
length = 3
),
second_column = list(
type = "integer",
max = 10
),
third_column = list(
type = "calculated",
formula = "second_column * 2"
)
)
)
random_data_frame(conf, size = 10)
#> first_column second_column third_column
#> 1 nbm 7 14
#> 2 k3N 7 14
#> 3 uVO 8 16
#> 4 HNn 2 4
#> 5 I2t 4 8
#> 6 5Ei 7 14
#> 7 7vE 2 4
#> 8 HMe 4 8
#> 9 yP5 1 2
#> 10 fT6 6 12