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 3n8 10 20
#> 2 cp9 3 6
#> 3 dsI 10 20
#> 4 ohD 0 0
#> 5 FsB 3 6
#> 6 H3l 9 18
#> 7 cSp 7 14
#> 8 oI1 0 0
#> 9 GEJ 7 14
#> 10 wT0 7 14