random_data_frame: Generate a random data frame from given configuration

View source: R/data_frames.R

random_data_frameR Documentation

Generate a random data frame from given configuration

Description

Generate a random data frame from given configuration

Usage

random_data_frame(configuration, size)

Arguments

configuration

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.

size

integer, number of rows to generate.

Value

data.frame

Examples

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)

fixtuRes documentation built on March 18, 2022, 6:13 p.m.