Initializes a new BenchDesign method object for benchmarking.

New BDMethod objects are typically not directly constructed as they have limited use outside of BenchDesign objects. Instead, methods in a BenchDesign object are more commonly created, modified or removed using function calls on the BenchDesign, e.g. using addMethod to add a new method object.

The constructor can also be used to access BDMethod objects stored in BDMethodList and BenchDesign objects.

BDMethod(x, params = rlang::quos(), post = NULL, meta = NULL, ...)

# S4 method for quosure
BDMethod(x, params = rlang::quos(), post = NULL,
  meta = NULL, ...)

# S4 method for `function`
BDMethod(x, params = rlang::quos(), post = NULL,
  meta = NULL, ...)

# S4 method for BDMethodList
BDMethod(x, i = 1)

# S4 method for BenchDesign
BDMethod(x, i = 1)

Arguments

x

main method function or function quosure. Alternative, may be a BDMethodList or BenchDesign object from which the BDMethod should be extracted.

params

list of quosures specifying function parameters. (default = rlang::quos())

post

list of functions to be applied to the output of x. (default = NULL)

meta

list of metadata. (default = NULL)

...

other parameters.

i

integer index or character name of BDMethod in BDMethodList or BenchDesign object.

Value

BDMethod object

See also

Examples

## create a simple BDMethod bdm1 <- BDMethod(x = base::mean) ## create a more complex BDMethod bdm2 <- BDMethod(x = function(x) { x^2 }, post = base::sqrt, meta = list(note = "simple example")) ## construct a BenchDesign with the BDMethod objects bd <- BenchDesign(method1 = bdm1, method2 = bdm2) ## access a BDMethod in the BenchDesign BDMethod(bd, "method1")
#> BenchDesign Method (BDMethod) ------------------------------ #> method: base::mean #> function (x, ...) UseMethod("mean") #> parameters: #> none #> post: #> none #> meta: #> none