generateData: Generate Data

Description Usage Arguments Details Value See Also Examples

View source: R/generateData.R

Description

Function to generate data.

Usage

1
2
3
4
5
6
7
generateData(function_f_1,
             argumentsTypeRestrictions_l = list(),
             replacementContext_l = setGenerationContext(),
             ellipsisReplacementContext_l = setGenerationContext(),
             defaultArgumentsContext_l = setDefaultArgumentsGenerationContext(),
             functionName_s_1 = deparse(substitute(function_f_1))
)

Arguments

function_f_1

a single R function, offensive programming ready, therefore using semantic argument names

argumentsTypeRestrictions_l

a named list. Each name must match a function argument name. Each content must be a vector of strings, each of them matching a retrieveDataFactory()$getKnownSuffixes() known suffix.

replacementContext_l

a generation context object, as defined by setGenerationContext function, applicable to standard arguments of the function, if any.

ellipsisReplacementContext_l

an ellipsis replacement context object, as defined by setGenerationContext function, applicable to ... arguments of the function.

defaultArgumentsContext_l

a default argument context object, as defined by setDefaultArgumentsGenerationContext function, applicable to default arguments of the function.

functionName_s_1

A character vector of length 1, holding the function name. Particularly useful in R scripts.

Details

Generate a driven aleatory set of data to be used as argument in a call to function fun_f_1. Generation is driven by the argumentsTypeRestrictions_l argument.

Value

A object with following names

generation argument name generation
codedata the generated data
context data type generation context
n number of first level data generations

See Also

Refer to coderetrieveDataFactory and to testFunction.

Examples

1
2
3
4
5
# typical example
op_sum <- opwf(sum, c('...', 'removeNA_b_1'))
op_sum_atr <- list('...' = c('i', 'd', 'c'))
ec <- setGenerationContext(0, TRUE, FALSE)
gd <- generateData(op_sum, op_sum_atr, ec, erc$hetero_vector[[1]], dac$none)

wyz.code.metaTesting documentation built on Oct. 6, 2021, 9:08 a.m.