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, with 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, as defined by setGenerationContext function, applicable to standard arguments of the function, if any.

ellipsisReplacementContext_l

a generation context, as defined by setGenerationContext function, applicable to ... arguments of the function.

defaultArgumentsContext_l

a generation context, 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. This is particularly useful, in 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 list with names generation, data, context, and n, representing respectively, argument name generation, data, data type generation context, and the number of data generated at the first level.

Generated data are ready for use and accessible using the data name of the list.

See Also

Refer to retrieveDataFactory 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)

neonira/wyz.code.metaTesting documentation built on Feb. 19, 2020, 12:46 p.m.