random_data_frame: Generate a random data frame from given configuration

Description Usage Arguments Value Examples

View source: R/data_frames.R

Description

Generate a random data frame from given configuration

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
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)

jakubnowicki/fixtuRes documentation built on Feb. 20, 2022, 6:14 a.m.